FORFILES – use to delete files older than specific time

Great built-in Windows command line tool to use if you want to purge backup files older than… say one week.

Batch file I create to to delete .bak (backup files) older than one week:

forfiles /P “<Path to files>” /S /M *.bak /D -7 /C “cmd /c del @PATH” 

From here, I set up Windows ‘Scheduled Tasks’ to run this batch file every night. Works great!

More info on switches:

http://en.wikipedia.org/wiki/Forfiles