Many times, files build up on servers in temp and log directories. Here’s one method to purge junk thats taking up space.
Download the VB script at the bottom of this page and use with the following syntax:
cscript c:\deloldfiles.vbs c:\data\logs 30 > c:\oldfiles.txt
This will delete all files under c:\data\logs older than 30 days and write the output to c:\oldfiles.txt. It will ONLY delete files, not directories or subdirectories. It will also not delete files that have the read only attribute set. You can run the script against remote machines, such as:
cscript c:\deloldfiles.vbs \\servername\e$\data\logs 30 > c:\oldfiles.txt
Included in the zip download is a batch file that I use, that let’s me specify the path, time and log file on the fly. It comes in handy when you need to quickly clean out a folder structure. Another helpful tip is to setup the script file as a scheduled job on the server.
Downloaded a total of 32 times
VB script originally found at:

