Extending on this question:
Automatically sync a folder to a USB when USB is plugged in?
I do not want an automatic script but just a small bash script to do the following:
- Copy current
~/Documents/
to a backup folder - Copy newer files from USB/Documents to
~/Documents/
- Copy and carry over deletions from
~/Documents/
toUSB/Documents/
I now have:
# Backup local:
rsync -av ~/Documents/ ~/backup20112012/Documents/
# Synch new files from USB:
rsync -auv /media/20CC-A5E5/Documents/ ~/Documents/
# Sync and delete USB:
rsync -av --delete ~/Documents/ /media/20CC-A5E5/Documents/
which works with one exception. If I delete a file in ~/Documents, it is created again in step 2 (cause it is on USB). Is there a way to omit copying files that have been deleted in step two?