Exclude folder from Spotlight indexing - via command line

976 Views Asked by At

Is there a command-line way to exclude folders from spotlight indexing? To do it via UI, you can use System Preferences >> Spotlight >> Privacy. But I'd like to be able to add various folders/directories to that Privacy list via command line.

1

There are 1 best solutions below

2
joshbillions On BEST ANSWER

I'm sure this isn't exactly what you meant by 'via command line', but you can add the extension '.noIndex' to a folder to have it ignored by Spotlight, or create an empty file in the folder named '.metadata_never_index'.