I’m pretty good with backups. I have six CD sleeves filled with digital media that spans my professional career back to 1997, and there’s one Holy Grail cataloging app which indexes the entire collection. I’ve been looking, though, for ways to make the process easier and more automated. After all, these are computers, right?
I suppose I could learn UNIX shell scripting and use rsync to do the heavy lifting, but I don’t have that much time. Instead, I’ve decided to bang my head against Apple’s Automator. I’ve been down this path before, as you may remember. This time, I found some help in various places and used a little more common sense to solve my problem.
My needs were this:
On a specified recurring date, make a copy of my Mail folders.
Compress it into a Zip archive.
Move it to my Backups folder.
Open my mail application, and email me a notification.
Simple, right? Some trial and error and six scripts later, I had a working application that did what I wanted it to do reliably, and I’ll share it with you here. (These instructions are for Automator 1.0.5; I haven’t updated to OS X 10.5 yet on this machine).
First, from the Finder actions on the left, drag Get Specified Finder Items over into the right window. Pick whatever files need to be backed up. (This was the step that stymied me last time, for reasons I can’t remember.)
Then, drag Create Archive from the same list. Rename it something that makes sense (instead of “archive”).
Drag Rename Finder Items over from the list. I added underscores for separators from the pulldown lists.
Drag Move Finder Items over from the list, and navigate to the place you want the final zipped file to live.
Note: I’m using Mail.app for my email, so there are prewritten Automator actions that ship with this program. If you’re using some other email client, this may not work for you.
Now, drag Launch Application over from the list. Select Mail.app from the pulldown list. In the gray action title bar, click the Files/Folders arrow and select Ignore Results From previous Action (otherwise you will email the documents to yourself).
From the Mail.app actions on the left, drag New Mail Message over, and fill out the appropriate information. (I wrote a short email that notified me of a successful backup.)
Finally, drag Send Outgoing Messages over to the right.
When all this is done, go to File -> Save As and name the action. Be sure to save it as an application. Test it out and see if it works. Make sure it doesn’t move your files from one place to another as opposed to copying them. I had issues when I used the Copy Finder Items action, where it simply moved the files instead of duplicating them, which meant I lost my email for about five minutes.
Now, to set it up as a recurring event, go to iCal and click on a date sometime in the future. Name it whatever you like. In the Alarm section, choose Open File. Directly under that pulldown, choose Other… and navigate to the Automator application you just saved. Once that is selected, you should be done.
And there you have it. An automated application that will back up a folder(s)/file(s) and send confirmation email on a specified date. I could add multiple things to this archive, set it up to compare two folders, write a log file, or a number of other scripted functions, but this works for the present day.
Coming up: An Automator 2.0/10.5 workflow to automatically mount an FTP server, compare two directories, and back up the local version. Handy for people who have multiple websites, like me.