Jump to content

Ignore Specific Extensions in File Search

Recommended Posts

It would be great if one could exclude from all search results files with a specific extension.


There are files in my Documents folder that I never want to look for, e.g., compiled files such as byte code for Python classes (.pyc), Java libraries (.jar), Java compiled classes (.class), automatically generated web pages (.html files) and so on.




I guess adding an option that hides files with some user-specified extension from Alfred search results should not be hard to implement (also in a second step, i.e., it is not necessary to exclude them from Alfred index, but just hide them a posteriori in the search results if specified). I think users could benefit from this, having personalized search results. 

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Can't be done, I'm afraid.


Alfred doesn't maintain its own index: it uses the macOS metadata search API, which is "whitelist-only". There's no (reasonable) way to exclude specific types of files or directories beyond adding them to the Privacy pane in Spotlight's settings. Your only realistic option is to create a File Filter that explicitly only searches .py and .java files.


This has been requested several times before, but it has been rejected on performance grounds. The main issue, as I understand it (which is not well), is that the metadata search returns lightweight "pointers" to results, rather than all the metadata, and Alfred would have to pull in the full metadata in order to do its own filtering, which could lead to horrendously slow performance in pathological cases (node_modules, I'm looking at you…)


Perhaps @Andrew has reconsidered now that Macs are a lot faster than they were years ago?


On 5/16/2019 at 3:16 PM, ioemilio said:

compiled files such as byte code for Python classes (.pyc), Java libraries (.jar)


Look on the bright side: At least you're not a Node developer. Not being able to blacklist node_modules makes Alfred (and Spotlight) more or less useless for searching within your projects. Also, you don't have to deal with JS…

Edited by deanishe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...