Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

When using Smartfolders in Mac OS 10.6.5, is it possible to choose where to search beyond the 2 button choices? One button is usually "This Mac' (too broad) and the other one is a folder that has never been the one I want - in fact, I would want to exclude a particular folder (ie the Library folder in my user directory).

Since we are given a choice of 2 places to query, why not any particular branch of the directory? TIA Allan

share|improve this question

1 Answer 1

Ok, there’s a way to “hack” into SmartFolders and change the locations.

Rules:

  • You can’t do it from the UI
  • It involves having the smart folder saved
  • I wrote it in spanish a long time ago in a blog post (spanish)

For the sake of helping you (I’m assuming you don’t speak spanish), I’ll transcribe the relevant information here.

Please note that the blog explains how to add more than one location to the search, not how to exclude (something I don’t believe is possible).

So, the short version:

  1. Save your smart folder, the search location is really not important (we’re going to change it!) but make sure you use the searching “terms” that you want. Name it something like: IHATESMARTFOLDERS. Ok, you can name it differently if ya wish ;)
  2. Go to your ~/Library/Saved Searches and you should see your saved smart folder.
  3. Once you have located your smart Folder, you have to open it with a text editor like TextWrangler (or anything that can save Plain Text). Do not use Pages
  4. Once you have it in your favorite editor, go to the end. You’ll see something like this:
<key>FXScopeArrayOfPaths</key>
<array>
           <string>/Users/martin/Desktop</string>
</array>

Note My smart folder was created for searching on my Desktop.

Good. As you can see the path is in an Array. If you know something about arrays, you’ll know that they are a collection of items. This means we can go ahead and add more items to this particular collection:

For example:

<key>FXScopeArrayOfPaths</key>
<array>
         <string>/Users/martin/Desktop</string>
         <string>/Users/martin/Pictures/MacStuff</string>
         <string>/Users/martin/Pictures/Me</string>
</array>

I have added two more folders to my smart -not so smart- folder.

Now in order for this to start working you have to:

  1. Save the smart folder (remember to use plain text!)
  2. Restart Finder.

And voilà.

Sadly, I haven’t found a way to exclude a location.

share|improve this answer
    
Terrrific. I also discovered that I could do what I needed using the UI - after years with OS X I just discovered today that searches will be particular to the icon one has selected in the sidebar. Your method may help me in the future - I am using smart folders as a daily planner - I really like it - I can make file names containing several key words (tags) and then use pre-defined smart folders like SaDec25 for that particular day or LA_EVENTS for all appointments I might have in LA. Working out real well. Thank again, Allan –  Allan Lombardi Dec 12 '10 at 6:52
    
Thanks again for the help. Do you know if the query language for smartfolders can do a boolean <OR> ? I would like a smartfolder that would include the files meeting a criteria OR a 2nd criteria. Only <AND> seems possible in smartfolders but this won't get me to where I need to go. –  Allan Lombardi Dec 19 '10 at 0:09
    
@Allan I’m sure (but not 100%) that you can do (for example) kind:music OR kind:document and it will look either. The OR/AND must be uppercase. Example: I want to find music files or documents that contain the word america. Here’s the spotlight query: (kind:music OR kind:document) AND america –  Martín Marconcini Dec 19 '10 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.