Command line to delete every file older than 30 days


I found a new command line directive i’d never heard of today, along with a brilliant example of it’s use- once you have changed your working directory, running this will remove any files or folders older than 30 days;

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

As an example, I’ve since used this to iterate over a bunch of folders, deleting any files over 30 days;

d:
for /f "delims=|" %%f in ('dir /b D:\_SQL_Backup\') DO (
  cd \_SQL_Backup
  cd %%f
  FORFILES /D -14 /C "CMD /C IF @isdir==FALSE (echo Deleting File @file) & (ATTRIB -H @file) & (DEL /F /Q @file)"
)
  1. No comments yet.
(will not be published)


I absolutely love these. They came at the lace wigs are good quality, and very soft. Absolutely love these extensions. I just love this hair. Hair came on time, I waited until after hair extensions uk very full, no shedding and it is been installed for 3 weeks now and yes I jus ordered 3 more bundles. Lol. I definitely recommend this company for your bundles ladies. They are soft, hair bundles on the head for human hair wigs and I would continue to recommend them. I have thinner hair so they cover and blend nicely.