Automatic Backup Script
I have a script that runs daily, creating backups of my MySQL database (Two different tables), along with my web root. Thus, creating three backup files each night.
I would like to have a script that stores weekly backups. I would need to copy the three most recently modified files out of the daily/ dir, into the weekly/ dir (Three files because I have three backup files each night...).
I'm not sure how to accomplish this. I know "ls -t" sorts by modified time. It would be awesome if "find" had a sort and limit option or something, but unfortunately the man page doesn't mention such a feature. mv `ls -t | head -1` weekly/ would work, but that would only copy the first file, not all three.
Thank you for your time and replies.
Last edited by Schiz0; 12-18-2007 at 10:47 AM.
|