Mac OS X : add a custom meta data field to any file

前端 未结 5 1781
有刺的猬
有刺的猬 2021-01-30 18:30

I would like to me able to set (and get) a custom metadata attribute for any file.

What is the best way to do this?

Thanks

5条回答
  •  感情败类
    2021-01-30 19:01

    This sounds like a job for extended attributes. You can get and set them from the command line with xattr, and from programs with getxattr and setxattr.

    However, extended attributes are (at least generally) not indexed by Spotlight. The only exception I know of to this is the "com.apple.metadata:kMDItemFinderComment" attribute, which should contain a binary-format plist with the actual indexable comment (see @PurplePilot's answer). This page claims spotlight will index other xattrs prefixed by "com.apple.metadata:", but I haven't gotten it to work.

提交回复
热议问题