Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- START_FOLDER = "C:\test\test"
- 'PREFIX = “.DS_Store”
- NumberOfDays = 10
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- ProcessSubFolders oFSO.GetFolder(START_FOLDER), iCount
- Sub ProcessSubFolders(oFolder, iCount)
- Set cFiles = oFolder.Files
- For Each oFile In cFiles
- If DateDiff("S", oFile.DateCreated,Now) > NumberOfDays Then
- oFile.Delete
- iCount = iCount + 1
- End If
- Next
- For Each oSubFolder In oFolder.SubFolders
- ProcessSubFolders oSubFolder, iCount
- Next
- End Sub
- WScript.Echo "Files deleted: " & iCount
Add Comment
Please, Sign In to add comment