Mac OS X: How to change the color label of files from the Terminal

Posted by Svish on Super User See other posts from Super User or by Svish
Published on 2010-07-28T17:10:13Z Indexed on 2012/09/16 3:42 UTC
Read the original article Hit count: 186

Filed under:
|
|
|

Is there a way I can set the color label of a file to some color when in the Terminal?

I know that the following command lists some info about what the color currently is, but I can't figure out how to do something about it. Like change it.

mdls -name kMDItemFSLabel somefile.ext

The reason I would like to know is that I want to recursively mark all files in a folder of a certain type with a certain color label (in my case gray).

I know how to do the finding:

find . -name "*.ext"

And I know how I can run the command afterwards for each file using -exec, but I need to know how to do the actual labeling...

I would like a solution that only involves commands built-in to Mac OS X. So preferably no 3rd party stuff, unless there is no other way.

© Super User or respective owner

Related posts about mac

Related posts about terminal