Automated backup of flash drives

Feb 26, '07 07:30:03AM

Contributed by: teamloco

I recently ran into a problem where I couldn't find my 512MB USB flash drive. Since I didn't regularly make backups of it, I thought I was toast. Valuable work information, portableFirefox, projects, etc., all gone. Luckily I did find it, and it prompted me to devise an easy way to back it up constantly. No way am I digging through the trash bin at 2AM ever again.

First, I installed Do Something When; it's a great little utility that has been featured before, and does exactly what its name implies. Next I set up a rule to run an AppleScript (saved as an application) whenever I mount my USB drive. All the Applescript says is:

do shell script 
  "rsync -rt /Volumes/USBdrivename/ ~/USBdrivename-Backup"
display dialog "USB drive backed up"
The word USBdrivename should be replaced with the name of your USB drive (and remember to quote it if it includes spaces). Copy and paste into Script Editor, modify to suit your needs, and save it as an application. I am not an AppleScript expert, and I'm sure this can be done better, but it was simple and works for me.

I had thought about changing the dialog to ask which way to sync (USB » Mac or Mac » USB), but this works so I left it. Now, every time I plug in my USB drive, the contents are backed up -- "just in case." It also benefits me in those times when I leave the drive at home.

Comments (16)

Mac OS X Hints