Computing.Net > Forums > Programming > VBS to delete subfolders in folders

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS to delete subfolders in folders

Reply to Message Icon

Name: melvin299
Date: March 28, 2009 at 09:55:26 Pacific
OS: Windows XP
Subcategory: General
Comment:

I am new to VBS and was wondering how you would write a script that would delete subfolders of subfolders found in a directory.... the delete would need to be by part of the name as well as the date created.

so... as an example....

folder A contains folder B
folder B contains folder C

search folder A.... and within any folders in folder A ( in this case B ), search those folders for folders ( in this case C ). If the folders found contain folder C and C is older than 30 days.... delete that folder and all of it's contents....

Thanks for any help in advance....



Sponsored Link
Ads by Google

Response Number 1
Name: reno
Date: March 30, 2009 at 01:55:58 Pacific
Reply:

i was thinking something like:

for each f in fso.getfolder(pathname).subfolders
if f.datecreated is older than 30 days then
f.delete

put it inside a function, and then recursively call it.
try it, if you stuck somewhere, post your code here.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VBS to delete subfolders in folders

Batch file to delete folder in fol. www.computing.net/answers/programming/batch-file-to-delete-folder-in-fol/16994.html

vbscript to delete subfolders www.computing.net/answers/programming/vbscript-to-delete-subfolders/10850.html

Batch to Delete files in a folder www.computing.net/answers/programming/batch-to-delete-files-in-a-folder/16299.html