As a part of moving away from maintenance plans, we are using the following code to purge the old backup files. for %i in (bak,bkp) do forfiles -p d:\dbbackups -s -D -2 -m *.%i -c "cmd /c del @FILE"
This works well; however, when there are no files to delete, the code errors out and the sql job fails with following exception. ERROR: No files found with the specified search criteria.
Any suggestions? Or is there a better way to achieve this?------------------------I think, therefore I am - Rene Descartes