We have a script that runs once a day from our virtual server, to do some housekeeping on our off-site backups (we FTP a backup of a number of folders to a remote server every day, then this script runs to rename the files, so they don't get overwritten the enxt day)
We want to enhance the script to do some housekeeping, so that the remote FTP site doesn’t get too full. Attached is the script, and a screenshot of how the remote backup folder looks today.
We want to keep only the last 7 days of ‘daily’ folders. They are named ‘daily’ when they are first created, then the script renames them to daily-dd-mmm. So every day as the script renames ‘daily’, it should ALSO delete any daily-dd-mmm folders that are older than 7 days. Please make the ‘7’ days a script variable that is easy for me to find in the script & change.
Similarly the ‘weekly’ folder is renamed to ‘weekly-dd-mm’ – we want to keep only the last 4 weeks.
Similarly the ‘monthly’ folder is renamed ‘monthly-dd-mm’ – we want to keep only the last 12 months.
Test the new script first in your own environment with dummy folders, and show screenshots of before and after. (We can't risk testing it in our live environment)
Hello ... it's January 21, 2010. Sitting in front of the terminal, you are hitting Enter. After a while, script which was enhanced by some guy from the GAF site (me perhaps ? ;) nicely removes old backups leaving only those that you need ... Actually I've already modified the script, code is working, tested and robust :)