Sub DeleteTxtFile()
Dim Directory
Dim Modified
Dim Files
Dim File
Set fso = CreateObject("Scripting.FileSystemObject")
Set Directory = fso.GetFolder("D:\test")
Set Files = Directory.Files
For Each folderIdx In Files
If Right(folderIdx, 4) = ".txt" Then
If DateDiff("D", folderIdx.DateLastModified, Now) > 10 Then folderIdx.Delete
End If
Next
End Sub
No comments:
Post a Comment