Delete every file older than 30 days


/ Published in: DOS Batch
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. 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)"

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.