blog advertising is good for you


blog advertising is good for you
User login

Rolling Your Own .Mac Backup QuickPicks

I’m a huge fan of .Mac for one – and exactly one – reason: Backup. Hang around me enough and I’ll make sure you’re using .Mac Backup before too long. But this isn’t about selling you on it, this is about making .Mac Backup even more useful by hacking up QuickPicks. QuickPicks are pre-rolled backup plans that snag specific types of files or data files that are integral to a specific purpose. Examples include QuickPicks that scrounge your home directory for all Word documents or that backup your iPhoto Library. Apple bundles a small smattering of QuickPicks with .Mac Backup and many apps install handy QuickPicks of their own, but it turns out we can make QuickPicks ourselves with a little effort.

While OS X is rather heavily laden with XML all over the place, Apple chose to make the QuickPicks definition file a ‘strings’ file, but that’s not the end of the world since it’s still an easily read and modified text file. If you “Show Package Contents” on any of the standard QuickPicks in /Library/Application Support/Backup/QuickPicks/, you’ll find buried therein a file named the deceptively named DefinitionPlist.strings file – after all, it’s not really a plist. But that’s Apple for you.

While I’m sure that the entire format is documented somewhere in the .Mac SDK, we don’t really care that much – if you peak into a few of Apple’s, you can pretty much figure out how to do whatever you want. The “Graft Paths” stanza defines what to back up or where to start scanning. “Prune Paths” is used to exclude certain paths. “Qualifier” creates a condition based on file type.

If we wanted, for instance, to search my home directory and /Users/Shared for .txt files, but exclude ~/Documents, we could go:

"Node Specifications" = (
    {
        "Graft Paths" = ({doNotCrossFilesystemBoundaries = 1; pattern = "~"; },{doNotCrossFilesystemBoundaries = 1; pattern = "/Users/Shared"; }); 
        "Node Specification Archive Version" = 1; 
        Operation = Include; 
        "Prune Paths" = ({doNotCrossFilesystemBoundaries = 1; pattern = "~/Documents"; }); 
        Qualifier = "(node.name.pathExtension = 'txt')"; 
        "User Action" = Log; 
    }
);
"Atomic" = 0;
"QuickPick Definition Archive Version" = "1";
"DocumentType" = 1;

The other file of note is the InfoPlist.strings file – found in the language-specific .lproj directories – the contents of which are passed through to the user to explain what the QuickPick will do.

I created com.macgeekery.adium.quickpick to back up my Adium preferences and all of my installed Xtras, and it looked something like this. I’ll include this, and one for Camino, as attachments to the article. You’re on your own for anything else. Eye-wink

Contents/Versions/1.0/Resources/DefinitionPlist.strings:

"Node Specifications" = (
    {
        "Graft Paths" = ({doNotCrossFilesystemBoundaries = 1; pattern = "~/Library/Application Support/Adium 2.0/"; }); 
        "Node Specification Archive Version" = 1; 
        Operation = Include; 
        "Prune Paths" = (); 
        "User Action" = Log; 
    }
);
"Atomic" = 0;
"QuickPick Definition Archive Version" = "1";
"DocumentType" = 0;

Contents/Versions/1.0/Resources/English.lproj/InfoPlist.strings:

"Description" = "Backs up Adium preferences, settings, etc..";
"QuickPick Info Archive Version" = "1";
"Name" = "Adium";

Average rating
(0 votes)
AttachmentSize
com.macgeekery.adium copy.quickpick.zip2.88 KB
com.macgeekery.camino.quickpick.zip2.86 KB
About JC
JC's picture

Author Biography

JC is a former Mac Genius and Mac-centric IT worker with a background in print advertising. He earned a reputation as a miracle worker when he saved the day at a new business pitch with the arcane knowledge that Apple’s ADB cables were nothing more than poorly shielded S-Video cables.

JC runs the Heroic Efforts Data Recovery Service and writes Ungenius, a tawdry tale of the life and times of a former Mac Genius.

You can contact JC via IM or via the contact form.

Actually, I believe that those files you reference are, in fact, plists. If you remember back-in-the-day before NeXT bought-out Apple, plist files were *not* XML. They were, in fact, files that looked exactly like the files you’re talking about. Wanna test that out? Try this:

defaults read com.apple.Dock > ~/Desktop/DockPlist.strings

Open the file. Discover that it is your Dock preferences, only in the same “not a plist” format that these QuickPicks files are in. Cool, huh?

JP

Adam Knight's picture

You’re talking about ASCII property lists rather than XML property lists, and you’re right. There’s also binary, FWIW, and plutil can convert between them all.

Post new comment
The content of this field is kept private and will not be shown publicly.
5 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.