Mac OS

Synchronising two external hard drives with rsync on a mac

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 to 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

or alternatively:

rsync -av --dry-run --delete --exclude=".*" /Volumes/PHOTOS/ /Volumes PHOTOS_BACKUP

Happy backups!

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.

Patrick Kua

Patrick Kua is an author, speaker and consultant who still finds time to code. He works as an active, generalizing specialist at ThoughtWorks and dislikes being put into a box. He is often found leading technical teams, coaching people and organisations in lean and agile methods, sometimes facilitating situations beyond adversity. Patrick is fascinated by elements of learning and continuous improvement, always helping others to develop an enthusiasm for the same.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button