\[Editor's Note: Share your scripting discoveries, comments, problems, solutions, and experiences with products. Email your contributions (500 words or less) to firstname.lastname@example.org. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100.\]
I read Moussa Faty's Reader to Reader: "Delete Files by Age" (March 2003, http://www.winscriptingsolutions.com, InstantDoc ID 37718), and I know of an easier way to delete files by age. The Microsoft Windows 2000 Server Resource Kit's Forfiles tool performs a command on each file in a list. For example, if you want to purge all the files in a directory that are older than 10 days, you can go to a command prompt and enter
The -p option is the directory in which to search for files, the -m option selects the files that match the specified string, the -d option specifies the date or days, the -s option recurses subdirectories, and the -c option is the command you want to run.