Delete files by date

2017-12-04T10:46:34+00:00 October 4th, 2011|Azure, Cloud, Windows|

Here is a command line that can be saved into a batch file that will delete files that are over 30 days old in a certain path:

forfiles /p "C:FOLDER" /d -30 /c "cmd /c del @path"

This can be used to clean up folders by deleting files that are older than the 30 days or however many days you want to set it to.

When saved as a batch file you can schedule it to run at certain times to clean up folders such as backup files or reports that are no longer needed.