rsync + Automator = free and easy backups for your Mac

One of the most basic types of backup is the folder sync. Folder A lives on your Mac. Folder B is on an external hard drive. You want to make Folder B look exactly like Folder A. Granted, anyone could make this happen by dragging and dropping the contents of A to B. If you have a lot of data, that’s going to take a while each time, though.

Fortunately, there’s a really easy, free way to make this happen with almost no effort (or geekery) on your part using two tools that are already on your Mac: rsync and Automator.

rsync

rsync is a command line utility that works on lots of operating systems, including Mac OS X. It’s really great at backing up data and can do some powerful and mind-blowing things, most of which you need to know nothing about.

I’m using rsync in a very basic way. For example, this command copies all of the contents of my Documents folder (under my Home folder, the ~ sign) to an external hard drive called “Lacie500”:

rsync -aE --delete ~/Documents/ "/Volumes/Lacie500/Documents/"

It essentially does two things:

  1. Copies anything that has changed since the last copy
  2. Deletes anything on Lacie500 that is no longer in the Documents folder on my Mac

In other words, it makes the Documents folder on Lacie500 look exactly like the Documents folder on my Mac.

rsync + Automator

Since I didn’t want to have to run this command from Terminal each time, I created a very simple, single-action workflow using Automator.

Transient

As you can see, I’ve got it set up to mirror my Documents, Pictures, and Music folder.

I saved the Automator workflow as “sync.app” so so that I could just store it right on the external hard drive's root folder. That way, all I have to do is plug in the external hard drive, click on the hard drive in Finder, then double click the app. The sync just happens, and I never have to think about command line syntax again.

Why this is useful

For starters, backups happen if they’re easy. Automating backups is one way to make them really easy.

I have what I consider a pretty decent backup strategy involving Time Machine, Carbon Copy Cloner, and Dropbox. But as I keep accumulating miscellaneous hard drives (not sure how that happens), I want to make use of them. This is one way.

Stuff I read as I wrote this