Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

Command Line Finder Labels

Earlier today, whilst reading Omni Group’s Mac OS X dev list, I saw someone remark that they didn’t like the fact that Subversion doesn’t preserve Finder labels.

Helpfully, of course, Subversion allows you to set arbitrary, versioned, properties on your files, so it’s actually pretty easy to store the Finder labels and retrieve them when you want them. Or it would be if there were any command line tools that could read and write them.

Well there are now (download the source code).

Once you have that installed, it’s just a matter of doing


to save your Finder labels as Subversion properties (a change that you can then commit to your repository), or


to restore them after an update.

Or you can do

getlabel myfile.txt

to see the colour of a label, or

setlabel myfile.txt red

to change its colour to red.

The getlabel and setlabel programs are provided with man pages. The Subversion scripts are not, but they should be self-explanatory anyway.