I've been using Transmit to backup my files to strongspace for a year or more, resting easy in the knowledge that I have an offsite snapshot of my Documents folder. I've also been backing up my Address Book files from ~/Library/Application Support/AddressBook and my iCal files too. However with the arrival of Leopard, the way the address book stores data has changed, using the new Core Data storage mechanisms. There is a new AddressBook-v22.abcddb database file and a new metadata folder. This data was taking a long time to backup via transmit. The mirroring in Transmit seems to change directories between images and metadata a lot. So I wanted a more simple and quicker approach.
I'm already using Automator via iCal to run the backups. See this recipe from Joyent. So I opened Automator and deleted the folder based backup I had been using and set about figuring out how to backup the data in my address book. I tried a bunch of different approaches, but the one which works is to export all the entries to vcards and then backup the resulting files.
To do this you'll need to do two things, create a new group in Address Book containing everyone and then create the Automator script below.

My oldest data in my Address Book is about 5 years old, as I've been upgrading macosx since 10.1. I think these settings will work for everyone, the important thing is that both rules have the same timeframe. This gets you a new group with every entry that you can access from Automator. The default All group is not usable from Automator.

Then you need to enter the three rules above in Automator. Find every person in the group you just created. Then you need to get the details of the people. Applescript, the technology behind Automator is a bit odd, what the first rule does is get a collection of objects representing the people, the second rule turns these into real people. If you run these three rules in isolation in Automator you can see this process happen, look at the results tab.
Then the last rule exports these people into vcard files in your file system, it will overwrite existing files. This is what we want to have happen in this case, but it is best to give it an empty folder of its own.
I then run my normal mirror upload to Strongspace of my Documents folder. I was getting mirror times of over an hour previously using the mirroring the address book folder. With this vcard based approach it takes seconds.
Tags:
apple, leopard, macosx, Address Book, StrongSpace, backup, automator, transmit

Leave a comment