9

I want to exclude Mail messages from showing up in Finder search.

->FINDER, NOT SPOTLIGHT<-

I have asked this question on other platforms, and I have found the emphasis is very necessary. Yes, you can exclude Mail from Spotlight by going to the Spotlight preference pane and unchecking Mail. This has no effect on Finder, at least in Mavericks (it did in Lion. I skipped Mountain Lion, but I believe it also suffers from this problem.)

You can also narrow what IS returned in Finder search, by clicking the plus sign and adding filters. But this is not a solution either: you can only filter what "is" returned, there is no "is not" option.

For bonus points, answers about how to exclude folders would also be wonderful. If you have ebooks, you know that they too turn up in pretty much every search. Put simpler, I just want the Spotlight preferences to apply to Finder...like they used to.

  • +1 I would also love to know how to get Outlook mail messages from showing up in either search. If I wanted to search my e-mail, I'd do that in the e-mail interface. – Aaron Bertrand Feb 26 '14 at 2:27
  • 1
    @AaronBertrand - Technically you can prevent both from showing Outlook results using the method below, by adding ~/Documents/Microsoft User Data/Outlook 2011 Identities to Spotlight's exclude list. However, Outlook uses Spotlight's index for it's own search function. By excluding the above folder from Spotlight you in effect exclude it from Outlook's search as well. This is one of those shortcomings that I and several of my users have reported to Microsoft as a feature request for the next version. You can do the same by clicking the Help menu in Outlook and choosing "Send feedback". – Mr Rabbit Feb 26 '14 at 13:02
  • 1
    @MrRabbit Yeah, that's the challenge, I still want to be able to search in Outlook, but I don't want Finder/Spotlight searches to mix 5,000 e-mail messages with 20 files. – Aaron Bertrand Feb 26 '14 at 15:44
10

It is inconvenient, but if you add -kind:mail after your search term in the Finder, it will exclude Mail messages too.

  • 1
    This does exactly what I wanted, and has no impact beyond Finder. Changing my accepted answer to this. – friggle Sep 4 '14 at 23:55
  • you should receive 100,000 upvotes for this answer :) I have been resorting to UNIX "find," which doesn't use indexing and is super slow, to search for files because of the idiotic defaults in finder and spotlight. – Reb.Cabin Sep 22 '15 at 15:29
  • @Reb.Cabin Thanks for the extra upvotes :^) Have you used mdfind at the command line? maybe mdfind XXXXX | grep -vi mail ? – beroe Sep 22 '15 at 20:34
  • @beroe thanks for the lead on mdfind. I think it will help speed up some of my searches ( I have over 2,000,000 files in various states of disorganization, and mostly I'm searching for a half-remembered fragment of a name or some keyword in the content when someone comes up to me and asks "do you know anything about 'blarghalism'." Of course, I wrote some notebook in the 90's about just that very topic; just let me find it... – Reb.Cabin Sep 23 '15 at 17:15
  • This does not work on El Capitan. – Jim L. Feb 27 '16 at 15:15
5

First of all, I should point out that — despite what it looks like — search in Finder is indeed Spotlight but with more options shown. The following information is based on research I've just done on my Mac running Mavaricks (10.9.2):

The reason why it doesn't work to just uncheck Mail is because (confusingly) the SysPrefs > Spotlight > Search Results tab only applies to the top-right corner Spotlight search and not the one in Finder.

However, there is a work-around that answers 2 of your question and proofs that Spotlight is the engine for Finder searches (and ditto for other apps, including Mail and Outlook):

You can exclude a folder from Spotlight-powered searches by dragging said folder to the list in the SysPrefs > Spotlight > Privacy tab.

Caveat/but/proof:

If you were to do this with the data folder of Mail.app (~/Library/Mail), you'll get this warning: Warning when adding Mail.app's data folder to "Privacy"

...Telling you that "the search feature won't work in some applications" If you click OK, Mail messages won't show up in Finder (or Spotlight) anymore but the same will be the case for the internal search feature in Mail.app itself, since it's Spotlight-powered...

(@Aaron Bertrand: Same for Outlook, since it's also Spotlight-powered. See first link above)

With regular folders — i.e. not in your hidden-by-default Library folder — you won't get a warning and hiding'll work with no caveats.

There actually is an option to tell Finder to not seach for a given type by writing "NOT eml" for instance, in the search field, which would exclude e-mail files. If you really wanted to, you could create an Automator-service and bind +F to it via SysPrefs > Keyboard > Shortcuts. The Automator AppleScript would be akin to:

activate application "Finder"
tell application "System Events"
    keystroke "f" using command down
    keystroke " NOT eml"
    key code 123 using command down #123 = Left Arrow, so we're moving the cursor to the beginning of the field
end tell

(I suck at AppleScript so there might be a cleverer way to go about it)

  • I'm accepting this as an answer because the fact that Finder search respects the Spotlight > Privacy settings is an answer to a number of Finder search problems. I had my eBook folders in there already, but Finder was still searching them. I removed and re-added them and they are now excluded from Finder search. – friggle Feb 26 '14 at 18:00
  • But it's still not a complete answer, because disabled Mail from being searched by anything ever isn't a full solution. It's pretty ridiculous that HALF the Spotlight preferences apply to Finder. It makes some sense since other apps are powered by Spotlight, but on the other hand, it worked in the earlier OSes. – friggle Feb 26 '14 at 18:06
  • @friggle I see your point. If I'd been able to find any trace of a "non-hacky" solution, I would certainly have provided it. That Apple pride themselves with making products with as few settings as possible sometimes means that weird stuff like this happens without anyone noticing... I even went poking around in "Secrets" to see if there was some obscure Spotlight/Finder flag that could be changed but to no avail. – Lasse Feb 26 '14 at 18:12
0

The root cause of this problem is that Finder by default searches "This Mac" - i.e. everywhere, including the Mail folders - so every search is dominated by dozens of unwanted email hits. Fortunately there's a simple solution:

In Finder...Preferences...Advanced, select "Search the current folder". This will limit the search to whatever folder you were in when you requested the search, thus excluding emails (and a lot of other unnecessary stuff too by the way). Problem solved.

Here's a link to the details: http://osxdaily.com/2013/03/12/change-finder-search-to-look-in-current-folder-rather-than-everywhere-in-mac-os-x/

  • 1
    The problem I have is that I need to search my Documents folder. Email events and attachments are files under that folder! 😡 – Jim L. Feb 27 '16 at 14:55

You must log in to answer this question.

protected by Community Jan 13 '15 at 22:37

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .