Alastair’s Place

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

Getlabel

Command line Finder labelling tools

I couldn’t find an easy way to get at the Finder label colours from the command line, so I wrote these two short command line tools to do so.

The first, getlabel, takes a list of filenames and outputs a list of label colours. The second, setlabel, takes a single filename and a colour and sets the label for that file.

There are two scripts included in this archive that show one way to use the tools to store Finder label colours in Subversion repositories. To store the colours, you just do

1
$ svn-save-labels

and the commit the changes. To restore them after an update, simply run

1
$ svn-restore-labels

The label colours are stored as versioned properties (the property name is “mac:colour”) in the repository.

Anyway, I hope someone files these useful (I’m sure they will).

You can download the source code from the mercurial repository. You’ll need the developer tools installed on your system, and you can then just type

1
$ make && sudo make install

to compile and install the tools and their instructions.