» about » content » twitter » github »

How to automatically delete old files in windows

Occasionally I need to write a Windows batch file to automatically clear out old files, so I'll post this here as a reminder (mainly to myself).

rem to test without deleting: forfiles -p "C:\backups" -s -m *.zip -d -7 -c "cmd /c echo @FILE"

forfiles -p "C:\backups" -s -m *.zip -d -7 -c "cmd /c del @FILE"

Here's more info on the above.

© Roqet 2019 :: 2019-01-04 14:18:13