I recently created a maintenance plan for our server to backup all the databases on a daily basis. In the cleanup step I set it to delete backups older than 7 day. I let the plan run for a week and checked on it to make sure the old backups were being deleted. This would be kind of a useless post if everything was working correctly, so as you guessed, they were not being deleted. I check everything on the plan: Username, folder name, first level subfolders, permissions on the backup folder, sql server agent permissions. You name it. All to find out that my problem was in the maintenance plan all along. The option for file extension was the issue. I had entered .bak when I should have entered bak. I was thinking hey, I set up a foreach loop to loop through text files I enter .txt so for backup files I should enter .bak: WRONG! Once I changed this option from .bak to bak everything worked fine. Now my maintenance plan backups and deletes everything older than a week!
haha! Nice one, thanks for sharing. I was banging my head trying to see what was wrong.
Here is another caveat on the backup maintenance plan I discovered. My backups would not delete and I did not have .bak in the file extension but I did have BAK in the file extension. Once I changed this to all lowercase, it worked like a charm.
Thanks for that great hint
Thank you Bradley. Super tip !
i have the same problem, everything look OK, task done, log success, but not delete anything,
your sharing fix my problem, thanks for sharing
Thanks! This solved my problem.
Nice Bradley – now how do we get MS to put this piece of crucial information in their documentation?
Harry, you ask a good question to which I do not have a good answer. There are a lot of things I would think should be in the documentation but aren’t. 🙂
I’m having the same issue with backups not being deleted, however I am not using .bak. I’m using bak as required and old backups still do not delete. A check of the logs shows the clean up task ran without error, yet is still not deleting the old files.
OMG!!! Thanks a ton. I have been banging my head over this for months. All because I had the “.” in there.
Many thanks for this, had the very same problem. Thank you for sharing 😉
It’s hard to believe, that this is still tripping us all up. Thanks again for sharing
Thank you so much! Appreciate you sharing this. Was a big help.
Awesome ..thanks.Worked a treat!
do wildcards work in the filename?
Thanks alot! its working perfectly now.
It is almost unbelievable to me that this is still an issue all these years later, but your post just saved my brain from exploding. Thanks so much!
Thank you, saved my day!