0

Possible Duplicate:
VB Script - move files older than 180 days from modified date to another directory

I am looking for a VBS scipt to delete the folders,files including subfolders older than x days. Can someone please help? I have more than 60 folders under below paths.

requirement

C:\winnt\Temp delete any unblocked (inactive) file or empty folder older than 2 days. D:\ drive delete any unblocked (inactive) file or empty folder older than 2 days.

Thanks, sandy

Community
  • 1
  • 1
Allie Shaffer
  • 21
  • 1
  • 4
  • I am very new to scripting.I have few sample script but that wont delete folder and files – Allie Shaffer Jan 24 '13 at 22:45
  • 2
    It's very simple to modify a script that *moves* the file to one that *deletes* the file. Please actually *read* the code and put some effort into figuring out how to modify it. This isn't a "please write some code for me" site, I'm afraid; we expect some effort be made into solving it yourself, especially when an existing answer provides 99.9% of the code you need. I'll offer a hint: Click the link in the comment to the article I linked, find the line that says `fileSystem.CopyFile`, and investigate what other methods `fileSystem` has that might have to do with performing a file **delete*. – Ken White Jan 24 '13 at 22:49
  • I think we can use objFile.Delete and we have define object file at the starting of script – Allie Shaffer Jan 24 '13 at 23:29
  • I have done changes filesystem.deletefile "c:\temp\ds\*.*" , and removed Echo, but this is only delete the files from single folder and it doesnt go through all the subfolders – Allie Shaffer Jan 25 '13 at 00:00
  • For goodness sake. You've received an answer to [that question yourself](http://stackoverflow.com/q/13091228/62576) before that shows how to iterate through folders. Combine the two. – Ken White Jan 25 '13 at 00:07

0 Answers0