Latest Tweets:
Check out my photos on Flickr.
Or maybe you'd prefer some music.
But if you're really bored you could always contact me.
In order to keep track of certain system changes we like to label stuff. That way when we install something that modifies the files in question, we’ll know it immediately because they stand out among all the colored files. But if you’re deploying a fresh image to a few hundred machines using tools like the wonderful instadmg and DeployStudio, it seems pretty dumb to boot every machine just to set some file labels by hand. That’s where this little bit of command line magic will help you out.
xattr -wx com.apple.FinderInfo "00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" /your/file.name
See that 04 among the sets of 00? That’s your color. But what number corresponds to what color? To find out, set the label color on a file and then issue this command
xattr -p com.apple.FinderInfo /your/labeled/file.name
I didn’t feel like checking them all myself, but I can tell you that 06 is purple, and 0C is red. Also keep in mind that all the 00s correspond to some other file attributes, so if you have something else set, this command will probably change it back to 00. I recommend that you use caution and throw the -p switch first to double check. Just don’t come crying to me if you mess up something important and your box won’t boot anymore :P
I’m using it for something stupid and overly complicated, but I’m sure there are a thousand other uses out there so have fun, and feel free to leave a comment letting me know if this has helped you out. Happy scripting!
OK, now I REALLY want an iPad http://www.youtube.com/watch?v=zx0G5phXfYk
listening to “Dhafer Youssef - Khamsa “The Khamriyyat of Abu Nuwas”” ♫ http://blip.fm/~tbvqu
Jon Bates (Mellowdrone) + Alessandro Cortini (NIN, modwheelmood, blindoldfreak) = awesomeness ♫ http://blip.fm/~t8h27
Patrick Eaves and his HUGE 18-month old Newfoundland water rescue dog: http://is.gd/dkQ1h
man, BMX bikes sure kick major ass. now i feel bad about leaving mine out in the rain all the time http://is.gd/dk1BH
listening to “Class Actress - Someone Real” ♫ http://blip.fm/~t4zhq