I have a SQL 2005 Maintenance plan that runs a backup to create a .bak file, and, on successful completion is supposed to run a Maintenance Clean Up task to delete any .bak files in the folder the back up task saves to that are older than 5 days.
My backups are being created, but my old files aren't being deleted. I don't see any errors in the log. I think that perhaps I have a permissions issue -- that the account the job is run under needs access to the folder the .bak files are to be deleted from. Does this seem like a likely cause of .bak files not being deleted?
How do I find out what account the job is run under? I'm guessing it would be the SQL Agent account. I thought that would be the account named 'SQLServer2005AgentUser' so I tried giving that account full control, but my .bak files are still not being deleted.
Should I take a different approach to cleaning up the old files? Or is there something else I'm doing wrong or not understanding?
I had this exact same problem. As I recall, the problem was with how I specified the file extension on the clean up task settings.
On the Maintenance Cleanup Task, check your setting for 'File extension'. If it's set to ".bak", change it to "bak" (no quotes obviously, and no dot).
This fixed the problem for me. This drove me crazy!