Tuesday, 3 February 2009

Delete SQL backup files over X days old.

Put this in a batch file and schedule it!

FORFILES /p C:\!DB_BACKUP_TEMP /s /m *.BAK /d -7 /c “CMD /C del /Q @FILE”

Careful copying the above command, the double quotes mess it up! copy into notepad, retype the double quotes, then it will be fine!

Note the -7 for 7 days.


No comments: