Okay, so I've written a script that uses mdfind to more quickly match files, however, I need to find the best way to check whether a target directory is indexed or not, so I can fall back to using find instead if I have to.

I'm assuming I'll need to use mdls, however this does still return information about non-index files and folders, just less of it. Is there a particular value I should query that will allow me to easily determine whether a file/folder has been index by Spotlight or not?

  • There are only two reasons why a folder will not be indexed. 1) Privacy settings 2) software failure of spotlight. Are you really looking to script around one or both of these two factors? – bmike Jan 19 '14 at 15:03
  • Yes; the script should be able to run on any folder, but since it deals with files that are normally indexed then I'm using mdfind to accelerate the search, but if it's going to fail then I need to know so I can use a fallback if necessary. – Haravikk Jan 19 '14 at 17:36

You must log in to answer this question.

Browse other questions tagged .