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)"


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.