April 25, 2013

SQL Maintenance Plan Cleanup Fails

I originally compiled this list for setting up Maintenance Cleanup Tasks in SQL Server 2005.  I had maintenance cleanup tasks failing and found a combination that worked for me.  Some might not make any sense at all, but after a week I was game to try anything:
  • no "." in front of "bak" or "trn"
  • use a \ at the end of the path (this is the one that got me working)
  • use * for the extension
  • switch between caps & lower case (BAK vs bak vs Bak)
  • switch on first level folders
  • the task checks the files to verify that they are backup files... so empty test files may not work.
If all else fails, use a scheduled task and a powershell script.