Posted By

Shawson on 03/24/10


Tagged

delete files old House keeping


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

adkatrit
Tyster


Delete every file older than 30 days


 / Published in: DOS Batch
 

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

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.

  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  

You need to login to post a comment.