Using rsync to keep a folder sync'd across two computers and a server

22 November, 2016

I use an rsync script to keep my pictures synced between two computers and a cloud host. Here's my method:

Usage

rsync -option --options sourcefolder/ sshuser@domain.ca:/path/to/destination/folder/
rsync -option --options sshuser@domain.ca:/path/to/source/folder/ destination/folder/

Options

-v verbose
-t preserve modification time of files
-r recurse
-a both -t and -r combined plus it preserves symlinks
-u skip things that have not been modified in the source
-c use checksum instead of modification date and size
-z compress during transfer (generallt between 1 and 1.2 is my rate for pictures)
-h human readable
--delete remove things from destination that don't exist in source
--progress show copy progress of each file
--rsh=ssh use ssh

As with most of my resused commands, I place them in my .bashrc or my .bash_profile files as follows:

alias backup.pictures='rsync -vauzh --delete --rsh=ssh /Users/myname/Pictures/ sshuser@domain.ca:~/PicturesBackup/'
alias download.pictures='rsync -vauzh --delete --rsh=ssh sshuser@domain.ca:~/PicturesBackup/ /Users/myname/Pictures/'