How to make spotlight ignore certain file types and directories

spotlight

Since spotlight continuously updates the index, sometime the file precedence gets changed around and I might type in "saf" and press return expecting to get Safari, but instead spotlight attempts to open some Java jar file.

Question Is there any way to make spotlight ignore certain file types or directories?

Best Answer

Short answer: yes.

Go to your System Preferences, then Spotlight:

Spotlight Preference Pane

You can disable and/or reorder the items in this list. By dragging Applications to the top, "Saf" will match Safari first (because it's an App, regardless of it's location).

If, on the other hand, there's a Folder(s) or Drive(s) that you want to explicitly exclude from Spotlight until you change your mind, turn onto the Privacy Tab (on top of that panel) and click the (+) button to browse for a folder.

Spotlight Privacy Pane

This window also accepts Drag and Drop of Folders or Drives (Volumes). In my Sshot, you can see that I exclude Clone (my weekly clone drive) from Spotlight so when I search for something I don't come up with duplicated results (one from the main drive and one from the backup).

I also have added a Public Folder where a lot of ppl drops stuff and I don't care about it nor I want it in my search results.

If you want to restore it, you can always remove it from this list (and give spotlight time to re-index it).

You can't (as far as I know) exclude by File type.

Note: in order to drag a "drive" just go go the finder, click on your Mac OS Volume and then press ↑ (the up arrow) to go back to the "root", you will see your volumes there (among other things). Drag it and drop it onto this Privacy tab and voilá.