Excluding specific file names and types (not categories, not folders) from Spotlight

findersearchspotlight

How can I completly and permanently exclude specific files (with names like readme or general file formats like .php) from Spotlight search?

One practical example:

I have important notes saved as TXT files which I need to find in Spotlight. However, I also get an overwhelming amount of readme.txt or faq.txt or even .php files shown which makes no sense at all that they are showing up.

They are file related to plugins and programs and in differnet locations.

It is especially bad when you search for a phrase or sentence that is within a text file. Then literally everything pops up.

All of the files need to stay where they are but some should be excluded.
If it is not possible what are possible ways to do it most efficiently.

Note: I am very well aware of the Spotlight settings in System Preferences, but it's not about locations or files in general. And I'm also not looking for moving files in a folder and exclude this folder or use the generally proposed .noindex solution.

Best Answer

I am the developer of HoudahSpot, a file search utility that uses the Spotlight index.

I don’t know of a way to teach the Spotlight interface to skip certain files. Nor do I know a way to get the Spotlight indexer to exclude files by name.

In HoudahSpot you can add criteria to exclude files whose names contain readme or faq or have the php file extension. You can then make this search your default setup. Your HoudahSpot searches will always start with these exclusions.