I have daily database backups scp'd to a directory on a local linux machine for multiple databases. The naming format is [dbname].backup; there is no timestamp and currently the latest backup overwrites the previous.
Management wants to keep old versions of the files with a datestamp appended to the end, and apply the following policy for retention:
- all files will be retained for 7 days
- the first backup of the month for each database will be retained for 12 months
- the first backup for each year will be retained indefinitely
I'm scratching my head how to write this script, so I was sorta hoping someone else had written something like this before, or perhaps there is a tool I am unaware of that can manage this sort of thing.
Anybody know of such a script or tool?