Guest User

Untitled

a guest
Feb 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. START_FOLDER = "C:\test\test"
  2. 'PREFIX = “.DS_Store”
  3. NumberOfDays = 10
  4. Set oFSO = CreateObject("Scripting.FileSystemObject")
  5.  
  6. ProcessSubFolders oFSO.GetFolder(START_FOLDER), iCount
  7.  
  8. Sub ProcessSubFolders(oFolder, iCount)
  9. Set cFiles = oFolder.Files
  10. For Each oFile In cFiles
  11. If DateDiff("S", oFile.DateCreated,Now) > NumberOfDays Then
  12. oFile.Delete
  13. iCount = iCount + 1
  14. End If
  15. Next
  16. For Each oSubFolder In oFolder.SubFolders
  17. ProcessSubFolders oSubFolder, iCount
  18. Next
  19. End Sub
  20.  
  21. WScript.Echo "Files deleted: " & iCount
Add Comment
Please, Sign In to add comment