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\"