Sync with rsync

I’ve been looking for a simple (and free) utility to sync a directory on OS X (say, /home/rbowen for example) with an external drive (say, my iPod, for example) for the purpose of backup. I found a variety of things on the Intarweb, but they all had one (or perhaps both) of two shortcomings. Either they were non-free, or they weren’t able to exclude directories from the backup.

Suddenly I discovered that I was, as usual, making a simple problem much more difficult than it needs to be. We have rsync. Why make it harder?

#!/bin/sh
rsync -av –delete –exclude-from=/etc/exclude /home/rbowen/Documents /Volumes/iPod/Data
rsync -av –delete –exclude-from=/etc/exclude /home/rbowen/devel/docs /Volumes/iPod/Data

Simple, no?

So, I plug in the ipod, run this shell script, and I have an up-to-date backup of these two important directories. And since rsync only copies files that are different, it’s amazingly fast, after the first time.