Return to Snippet

Revision: 25242
at March 24, 2010 07:05 by Shawson


Initial Code
FORFILES /D -30 /C "CMD /C IF @isdir==FALSE (echo Deleting File @file) & (ATTRIB -H @file) & (DEL /F /Q @file) ELSE (echo Deleting Directory @file) & (ATTRIB -H @FILE) & (RD /S /Q @FILE)"

Initial URL
http://www.shawson.co.uk/codeblog/command-line-to-delete-every-file-older-than-30-days/

Initial Description
I use this for house keeping logs spat out by a ecommerce system- Just wack it in a batch file and setup a windows scheduled task to kick it off.

Initial Title
Delete every file older than 30 days

Initial Tags
files

Initial Language
DOS Batch