How to programatically hide file and folder from Spotlight?

Specifically I want to hide my application's temporary files from Finder's "All My Files"? Is the an api for Spotlight privacy?


(There is an inline screenshot, but I can't see it outside of the post editor)

Link to screenshot: https://imgur.com/a/9u3Cd

Replies

The standard technique for this is to put the stuff you don’t want indexed into a directory with the

.noindex
suffix.

Note It’s surprisingly hard to find formal documentation that describes this. The best I could come up with is QA1497

FSDeleteObject
fails with
fBsyErr
, sometimes.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"