Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AppleCat

macrumors newbie
Original poster
Jun 10, 2011
6
0
I wish to have customized attributes for some of my files, just like how they have permissions, creation date, and so on.

It seems that HFS+ and Spotlight supports this, and I've looked at various classes like MDItem, but the documentation on Dev Center leads me around in circles, and I get the idea that a lot of cross-references are missing. For someone new to all that material it's like navigating a maze.

It's OK if Spotlight indexing is required, but it's necessary that the attributes persist when I copy the files around, and that this can be done programmatically without having to install plugins or any kind of additional system components.

Any pointers?

Thanks.
 
Last edited:
See the xattr command:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xattr.1.html

Note the links at the end of that reference, which point to man pages for C functions like getxattr, listxattr, and setxattr.

There are limits on which xattrs are preserved by which programs. So be prepared to make tests and experiments.

Also see this:
http://en.wikipedia.org/wiki/Extended_file_attributes

And Spotlight metadata isn't the same as xattr's. Xattrs are per-file attributes. Metadata is a separate database, filled with some data extracted from xattr's, file-embedded metadata such as ID3 or Exif tags, Posix permissions, and Posix stat(2) file state.
 
This is exactly what I was looking for. Thanks so much for your help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.