2

I am trying to create a smart search folder that only searches for items contained within specified folders. I have tried using the "Document Container" attribute, but I can't figure out how to use it correctly. Can someone walk me through an example of creating this kind of smart search?

  • Just navigate to the desired folder before creating the smart folder - or are you wanting to combine a group of searches? – red_menace Nov 06 '19 at 22:47
  • https://apple.stackexchange.com/questions/183054/document-container-vs-folder-name https://apple.stackexchange.com/questions/132860/smart-folder-filter-does-not-contain https://apple.stackexchange.com/questions/56973/how-can-i-create-a-saved-search-that-excludes-a-specific-folder-from-the-results/91583#91583 – anki Nov 06 '19 at 23:06
  • Yes, I would like to include several folders and also have the ability to exclude folders. How do I do that? – Peter Schorn Nov 08 '19 at 00:03
  • @red_menace , I am aware that if you navigate to a folder and then create a smart folder, you can choose to only search within that folder; however, I would like to search multiple folders and exclude folders. Ankii, I looked at all of those links you attached, and, unfortunately, none of them answered my question. Do you know how to do this? – Peter Schorn Nov 08 '19 at 02:36
  • As indicated in the previous links, there isn't a way to specify search folders in the Finder's Smart Folder query, so you would need to use a shell utility such as find or use something like NSMetadataQuery from a Cocoa app or script. You wouldn't be able to use the Finder for the results, though. – red_menace Nov 08 '19 at 02:56
  • @red_menace So then what does the "document container" attribute do? Because I haven't been able to return any search results at all with it no matter what I type. Finally, what about the "Raw Query" attribute? Can I use that to specify a file path? – Peter Schorn Nov 08 '19 at 03:07
  • From the first link, the Document Container appears to be specific to iCloud. The raw query will let you do some comparisons and use times, but the search folder is set by the Finder. Spotlight doesn't normally keep any path metadata. – red_menace Nov 08 '19 at 03:30
  • I really appreciate your help so far. I've tried Document Container with iCloud and still haven't figured out how it works. Could you give me an example of what you can do with it? @red_menace – Peter Schorn Nov 08 '19 at 04:02
  • I don't use iCloud for documents, but a raw query would look something like kMDItemLastUsedDate >= $time.today(-1). – red_menace Nov 08 '19 at 04:46

0 Answers0