This is a long shot, but is it possible to create a Smart Folder which, instead of building its search using the Search Criteria UI, but instead use the properly formatted output of necessary for a Smart Folder from an AppleScript or bash script which would create said list?

For example, is it possible to create a script that would use something like ack or locate to instantly search a folder hierarchy and then apply a regex to match a specific set of files within that list? The search criteria usable in Spotlight search has a pretty weak set of metadata attributes that are available in the Finder UI so it would be amazing to be able to make my own function that outputs directly into the Smart Folders construct.

I suppose I could make an independent script that doesn't use Finder or Spotlight at all which regularly refreshes a directory's contents with a set of symlinks, but that seems unnecessarily resource intensive when ideally the script need only be executed with the folder is opened or referenced. Integration with Finder at even a rudimentary level would be hugely advantageous. I suspect folder actions might be a way to trigger this, but again I feel like the complexity level would make this inefficient.

  • A "Smart Folder" is a just a an XML file containing Spotlight search criteria - it is a Finder construct.. – red_menace May 18 '19 at 3:24
  • 1
    Have you looked at the "other" item in the Smart Folder creation criteria UI? At least on my system, it includes things that are obviously supplied by applications I have installed, like "Number of checked items in the OmniOutliner document," so there is obviously some way to arbitrarily modify the search criteria. – Jan Steinman Sep 26 '19 at 6:45

You must log in to answer this question.

Browse other questions tagged .