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)