Dim fso As FileSystemObject
Dim f As Folder
Dim fc As Files
Dim fl As File
Dim ts As TextStream
Dim oldFile As String
'Dir1.Path = Drive1.Drive
If Dir1.Path = "" Then
Exit Sub
Else
Set fso = New FileSystemObject
Set f = fso.GetFolder(Dir1.Path)
Set fc = f.Files
For Each fl In fc
If Day(fl.DateMaxModified) < (Day(Now) - 5) Then
oldFile = Dir1.Path & "" & fl.Name
fso.DeleteFile oldFile
End If
Next
End If