This is more of a reminder for myself so I don’t need to keep googling or looking at
man when I need to look up the syntax.
Let’s assume you have two hard drives, ones called
PHOTOS the other other
PHOTOS_BACKUP. You can use the following command to sychronise photos (including removing all files that were deleted on
PHOTOS_BACKUP.) also ignoring backup files (.* files).
rsync -av --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP
It’s nice to test this on a smaller folder first if you like. You should note the slash and lack of slash matters. To do a dry run try:
rsync -avn --delete --exclude=".*"
/Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP
rsync -av --dry-run --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP
Published on System Code Geeks with permission by Patrick Kua, partner at our SCG program. See the original article here: Synchronising two external hard drives with rsync on a mac
Opinions expressed by System Code Geeks contributors are their own.