Skip to main content
Notice removed Draw attention by Andrew
Bounty Ended with Jason's answer chosen by Andrew
Tweeted twitter.com/askdifferent/status/993662873242042368
Added info gleaned from comments. Slight reformatting.
Source Link
Monomeeth
  • 64.9k
  • 14
  • 152
  • 190

I like to tag files with xattr, e.g. xattr -w user.foo bar myfile. Is there a way that I can then use Spotlight to search for a given xattr key (or key-value pair)? E.g.

Is there a way that I can then use Spotlight to search for a given xattr key (or key-value pair)? For example, if I put foo or foo:bar in the Spotlight search bar, I'd like it to return myfile in the result list.

I realize you can do this by writing the com.apple.metadata:_kMDItemUserTags attribute - but this is not very portable, so I'm curious if this can be extended to all xattr tags.

I like to tag files with xattr, e.g. xattr -w user.foo bar myfile. Is there a way that I can then use Spotlight to search for a given xattr key (or key-value pair)? E.g. if I put foo or foo:bar in the Spotlight search bar, I'd like it to return myfile in the result list.

I like to tag files with xattr, e.g. xattr -w user.foo bar myfile.

Is there a way that I can then use Spotlight to search for a given xattr key (or key-value pair)? For example, if I put foo or foo:bar in the Spotlight search bar, I'd like it to return myfile in the result list.

I realize you can do this by writing the com.apple.metadata:_kMDItemUserTags attribute - but this is not very portable, so I'm curious if this can be extended to all xattr tags.

Notice added Draw attention by Andrew
Bounty Started worth 50 reputation by Andrew
Source Link
Andrew
  • 507
  • 1
  • 5
  • 18

Is there a way to get Spotlight to search for xattr?

I like to tag files with xattr, e.g. xattr -w user.foo bar myfile. Is there a way that I can then use Spotlight to search for a given xattr key (or key-value pair)? E.g. if I put foo or foo:bar in the Spotlight search bar, I'd like it to return myfile in the result list.