How can I write a v. simple shell script to back selected files by date
I'm using Ubuntu 9.04 server (yes, it should be 8.04 LTS) and Moodle 1.9
I'd like to make a 'small' backup for keeping offsite so I thought I'd just back up the course backup .zip files.
I've figured out that I can use the command
sudo cp /path_to/moodledata/[[:digit:]]*/*.zip /backupdirectory
to copy out just backups from the moodledata directory.
Now my problem is that I have set to keep 5 backups of each course. I changed this to 1 as a quick workaround but only those courses that get backed up delete the extra backups so I now have somewhat less than 5x the amount of data I want.
I feel sure there must be a way to write a shell script that would look into each backup directory and select only the newest *.zip file for copying and that then all my troubles will be at an end.
Can anyone help me?