Sunday, 17 February 2019

How can I batch delete all files of a certain type in a folder newer than a certain date on Windows?


So Google Music decided to download about half of my uploaded music library to my local music library when I told it to download my purchased music, so now I have a bunch of MP3s I need to delete automatically.


Can I get any help here? I'm not so great with batch script.



Answer



You can use forfiles


forfiles /p g:\music /d -30 /c "cmd /c del @file"

This will delete any file older than 30 days.


Read about forfiles syntax here


If it's not there in your system, download forfiles from MSFT's Reskit ftp


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...