Execute a command on a file or set of files

forfiles – a resource kit tool that iterates files in a folder, can do it on date, and let you then run a command

You can get it here: ftp://ftp.microsoft.com/ResKit/y2kfix/x86/

http://technet.microsoft.com/en-us/library/cc753551%28WS.10%29.aspx

This command should (I haven’t tested it myself) delete all files older than 30 days, under c:\temp and recurse into subdirectories.

forfiles /p "C:\temp" /s /m *.* /d -30 /c "cmd /c del @path"