Ver Mensaje Individual
  #10 (permalink)  
Antiguo 22/04/2008, 10:25
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 20 años
Puntos: 839
Re: eliminar base de datos por fecha

Yo propongo esta solución:
Código:
 
Sub DeleteBackup(ByVal Path As String)
On Error Resume Next
Dim SF As Scripting.File
Dim FSO As Object
Set FSO = New Scripting.FileSystemObject
Dim FolderName As String
FolderName = Dir(Path & "*.*", vbDirectory)
Do
    If FolderName = "" Then Exit Do
    If GetAttr(Path & FolderName) = vbDirectory And FolderName <> "." And FolderName <> ".." Then
        If FSO.GetFolder(Path & FolderName).DateCreated < Now - 4 Then
            Kill Path & FolderName & "\*.*"
            RmDir Path & FolderName
        End If
    End If
    FolderName = Dir
Loop
End Sub
Código:
DeleteBackup "C:\WINDOWS\Pollo Feliz\Pv Traslados\tickets\"
DeleteBackup "C:\WINDOWS\Pollo Feliz\Pv Traslados\Inventarios\"
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.