I have written this backup script that looks in a file and copies recent files into a folder.
#!/usr/bin/bash
# the number of days to do the backup for.
days=2;
# the files to backup.
location[0]='/opt/location'
# the location to copy the file to
copyLocation='/users/me/Backup/firstBackupScriptTry'
# preform the back up
for i in ${location[*]}
do
find $i \! -name '*.class' -mtime -$days \! -type d -exec cp {} $copyLocation \;
done
It works but it is not that useful.
I would prefer the script to preserve the directory structure when it copies. Ie I would like it to do: cp -r from to
but only copy the recent files.