Jump to content

alfred:ignore comment doesn't ignore recursively

Recommended Posts



I'm a huge fan of Alfred, and I use it every day for many things. In my setup, there are always a number of directories I like to exclude from Alfred's result list (such as any node_modules/ or bin/ directories). Currently, I must always manually add them to the Privacy tab in Spotlight preferences, though this is far from ideal (because I have two Macs, I must perform this chore on them both).


I llooked through the Alfred docs in search of a better solution (ideally, something I could automate) and discovered the alfred:ignore Spotlight comment, which was exactly what I needed (or so I thought). However, after applying alfred:ignore (programatically, of course) to all directories I desire to exclude, I noticed something rather peculiar and counterintuitive. It seems that alfred:ignore only ignores the directories themselves (the ones to which you add alfred:ignore), but not any their subdirectories. As a result, though I no longer see the ignored root directories in Alfred, all of their subdirectories still show in the results.


Things I've tried: reloading Alfred's cache via the reload keyword, and clearing Alfred's application cache under Alfred Preferences > Advanced, but neither of those options made Alfred ignore the subdirectories of the directories I've ignored.


Questions: is this a bug or is this the expected behavior? And if the latter is true, then how could I tell Alfred to recursively ignore directories in a way that can be automated?


I hope that all makes sense. Please let me know if I need to clarify anything.


Thanks in advance,


Edited by caleb531
Link to post

This is, AFAIK, the expected behaviour.

Alfred doesn't do much in the way of post-filtering the results it gets from the metadata subsystem. It will ignore individual files and folders marked "alfred:ignore", but it won't then crawl up the file tree to see if any parent directories are marked "alfred:ignore".

This is for performance reasons, and is (again, as far as I know) very unlikely to change.

I'm not sure what you're trying to achieve, but perhaps you could create a Smart Folder that would show all the folders you wish to exclude (e.g. "all folders named 'bin' or 'node_modules' or …), then drag them from the Smart Folder into Spotlight's Privacy tab. And then repeat for any folders that subsequently show up in the Smart Folder.

Link to post

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...