10.4: A simple Mail backup Automator workflow

Jun 04, '07 07:30:03AM

Contributed by: Anonymous

There are lots of roads leading to Rome, and there a lots of ways to do the Mail backup task on OS X. A really simple and effective way is to let Automator do all the work. Here is how it's done. (You may wish to quit Mail before you start, just so it's not receiving new messages just as you're trying to create a new backup.)

  1. Start Automator
  2. Drag drop ~/Library » Preferences » com.apple.mail.plist and ~/Library » Mail into the Automator panel. This will automatically create an Automator action (Get Specified Finder Items) containing the two items you dropped.
  3. In Automator's Library column, go to Finder and choose Create Archive. Drag it to the work area on the right, below the existing command. Change the 'Save as' value to something other than archive, if you wish.
  4. In the Action column, drag Rename Finder Items into the work area, below the other two commands. By default, this will add a date and time stamp to the existing filename.
  5. Save the whole Automator workflow as a Program (you can choose this option in the Save dialog).
This workflow will create a file named Archive-xx-xx-xx-xx.zip in your Documents folder (unless you changed some of the settings) containing a zipped archive of your Mail folder and settings for the current user.

There are quite a lot of options you can modify to improve this workflow. For instance, you can choose a different archive name and location. The idea behind this simple workflow can be used to handle a lot of backup tasks -- i.e. doing a backup of the whole Delicious Library database. (For the first action, just drag and drop the directory ~/Library » Application Support » Delicious Library, and the file ~/Library » Preferences » com.delicious-monster.library.plist.)

[robg adds: To further automate things, you could use any of a variety of tools (iCal's ability to run an AppleScript as an alarm event; Cronnix; cron) to schedule your script to run each day at a given time. I've said it before, but Automator is really one of 10.4's hidden gems -- I learned even more about it on last week's MacMania Geek Cruise, and came away even more impressed with its capabilities.]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20070526084637560