This post (see below) was taken from Scott’s blog and works for Vista/2003/2008, I am yet to find the cool solution for XP.
This problem has nagged at me for years. Here is a batch command to delete files on a Windows 2003 machine.
Forfiles -p c:ackup -s -m *.* -d -5 -c “cmd /c del /q @path”
This will delete all files in my backup directory older than 5 days. To test it first, use this:
Forfiles -p c:ackup -s -m *.* -d -5 -c “Cmd /C Echo 0x22@Path@File0x22”
Workarounds for XP users might be;
http://windowsitpro.com/article/articleid/71600/jsi-tip-0274—delete-files-older-than-xx-days.html (but this require additional software to be ‘installed’).
Hmm the below seem to be some unix variant, but maybe something similar is possible in Windows.
http://lifehacker.com/software/command-line/cli-fun–delete-files-older-than-x-days-239124.php (seem cool)
find /path/to/files* -mtime +5 -exec rm {} ;
http://lifehacker.com/software/geek-to-live/geek-to-live-hard-drive-janitor-133190.php (the deluxe edition)