1.

Solve : Batch file to delete unknown directories?

Answer»

I am trying to write a BATCH file to delete folders and files under unknown folders. I have home directories and then username for the next folder (the unknown part) then UNDERNEATH the username I have a preview folder and also files. I would like to delete the preview for all users at a specified interval. I would also like to delete the files underneath the username at a different specified interval. I do not know the usernames. Can I get a list and output to file and somehow read those into the path I would like to delete. Any help is GREATLY APPRECIATED!Unless you're are using a MS-DOS system, batch language is simply the wrong tool for this task. Yes, it can be DONE by nesting a series of FOR statements used in conjunction with DIR, DEL, RD target statements.

If you are using Windows, a better solution would be using WinScript. The current version can be downloaded from:

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp

In the package is a great help file, with examples for every object, method and property that WinScript supports. With a little clever cut and pasting you should be able to construct a script in no time.

If you run into any problems, there are many people here that can assist you.

Good luck.

Thank you for the information. Do you know if that tool is available for Windows 2003? I didn't see a download that supported 2003. Thanks!Use the Script 5.6 download for Windows 2000/XP. Microsoft has not updated the script components in while.

The GetFolder and GetFile methods should be especially useful for your task.

You are great! Thanks for the help![aw shucks]



Discussion

No Comment Found