 |
 |
How can I see a file's color label from the command line?
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
You know how from the Finder you can right-click and set the "Color Label" of a file? How can I see that from the command line? Probably best would be if I could run ls and get an extra field that has strings in it like "Green", "Purple", etc.
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
The thing is, we've got a GNU/Linux box running Samba here at work, and when you mount a samba share from a Mac and browse around, you can set and unset colors for various files. (!) How can this be? The files are on a unix box, and unix knows nothing of "colors". What magic is happening that lets the mac set "color labels" on files which reside on a file system (ext3 in this case) that knows nothing about color labels?
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: UK
Status:
Offline
|
|
The resource fork for a file on a non HFS volume for a file called say xxx is stored in a file ._xxx (you will probably have seen these littered about the ext3 filesystem along with .DSStore files) and in this case contains the metadata for the label setting
If you are running Tiger then you are in luck for getting at the labels from the command line...
Code:
mdls -name kMDItemFSLabel <filename>
will return the numeric setting of the label (0 through 7)
|
|
|
| |
|
|
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
Sun of a gun! Thanks ids! I see that I can even search the whole HD (?) for files of a given label:
mdfind 'kMDItemFSLabel == 7'
Any idea if you can get mdls/mdfind for Debian or MS Windows? Or maybe similar functionality in some sort of GUI tool for either Debian or Windows?
Ahh... For looking at Mac files on other OS's, what might be very useful on other OS's would be a shell script to run mdls and then produce some nice colorized html for your web browser to browse your file system...
(hmm... Darn. Tried opening one up in vim but they're binaries. The 'file' command says these little ._foo files are "AppleDouble encoded Macintosh file". Anyone know how to un-encode these? :) ).
|
|
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
You can't get thme for Linux, at least that I now of. They're Apple specific commands, although I suppose you could grab them from the Darwin source and compile them. And technically, the metadata isn't stored in the resource fork, rather the metadata is stored next to the resource fork in the particular scheme used on non-HFS disks.
Unencoding AppleDouble? Yeah, drop them on Stuffit Expander... although just copying the actual file in the Finder back to an HFS drive should do the trick. Decoding them on an e2fs drive doesn't make much sense - that would just place the metadata back into a filesystem that can't store it, so itwould be lost. You can find the AppleDouble documentation on the 'net if you look around a bit.
|
|
|
| |
|
|
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
Thanks P. Will look into it.
> Decoding them on an e2fs drive doesn't make much sense - that would just place the metadata
> back into a filesystem that can't store it, so itwould be lost.
?
Well, the point would be this: a mac user remotely works with some files on a GNU/Linux ext3-formatted file server. Suppose the mac user uses Color labeling to label some files green, some red, some yellow. Then tells a coworker to please have a look at all the green files.
The coworker may not be running a mac, but instead may be accessing the file server from a GNU/Linux box (or even [shudder] an MS Windows computer). How do they know which are the "green colored" files? If they had mdls, it would be possible to create a script around mdls to write some colorized html to show them which files are "green", which are "red", "yellow", or just not labeled with a color.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|