How can I create a Saved Search that excludes a specific folder from the results?

I looked at some of the saved search files in Finder's application bundle, and for example /System/Library/CoreServices/Finder.app/Contents/Resources/MyLibraries/myDocuments.cannedSearch/search.savedSearch used a format like this for excluding directories:

<key>FXScopeArrayOfPaths</key>
<array>
  <string>~/</string>
  <string>-Library</string>
  <string>-Music/iTunes</string>
  <string>-Documents/Steam Content</string>
  <string>~/Library/Mobile Documents/</string>
  <string>-com~apple~Keynote</string>
  <string>-com~apple~Pages</string>
  <string>-com~apple~Numbers</string>
</array>

So you can exclude subfolders by adding strings that start with a minus character after a full path. Something like -~/Library doesn't seem to work.

You can edit savedSearch files by dropping them on a text editor. RawQueryDict:SearchScopes and FXScope:FXScopeArrayOfPaths seem to list the same paths by default, but just editing the second one appeared to exclude folders at least in Finder.


If you hold option the (+) button to add a search criteria will become a (…) and an Any/All/None block. Set this to None.

For the criteria select Document Container. It won't be in the default list alongside Name, Kind, etc. Select Other… to select it from a list of additional criteria so long it has its own search feature: All Those Attributes

Set this to the name of the folder that you'd like to exclude using whatever is/contains/begins with/ends with you find suitable.

The end result should look something like this: result