Jump to content
omorillon

Excluding Folders

Recommended Posts

How can I exclude folders from my search results? I have Parallels installed, which created a Windows Application folder and every time I launch an application. For example Google Chrome I get two options, the mac version and the version installed in Parallels. 

 

I know that Alfred is smart enough to show the mac version first but it would be nice to avoid search results from specific folders.

Share this post


Link to post

You can exclude files/folders by adding alfred:ignore to the Spotlight Comments of the file/folder you want Alfred to ignore.

 

You can also add files/folders to System Preferences > Spotlight > Privacy to ignore it.

 

You might need to clear Alfred's caches (type reload in Alfred) for it to pick up the updated metadata.

Share this post


Link to post

Neither of these methods is working for me. I added the comment, and added the folder containing the applications I don't want to show up in my search results to System Preferences > Spotlight > Privacy  but I'm still seeing them. Is there anything else I can do?

 

 Screen%20Shot%202013-03-23%20at%206.12.4

Share this post


Link to post

I just realized that Spotlight no longer shows results for the Windows Applications folder, but why does Alfred keep showing me those results? Is there a Spolight setting within Alfred I need to look at?

Share this post


Link to post

I just realized that Spotlight no longer shows results for the Windows Applications folder, but why does Alfred keep showing me those results? Is there a Spolight setting within Alfred I need to look at?

 

Have you tried reloading the Alfred app cache? Check out the Advanced tab in Alfred's preferences to clear the cache. You could also try dragging the Applications folder in the Privacy section, waiting a moment, and then pulling it back out. That ill cause OSX to reindex the Applications folder.

Share this post


Link to post

Thanks for the advice all. The alfred:ignore tip didn't work for me, although maybe I just needed to wait longer for the cache to reload. Whatever the case, the spotlight privacy settings worked. My next question is: is it possible to tell alfred to ignore a folder in general search, but to not ignore when using a specific keyword? I have many articles on my computer that I don't want to sift through every time I use alfred, but I want to be able to search through them with a keyword "article." Does anyone have any ideas?

Share this post


Link to post

Thanks for the advice all. The alfred:ignore tip didn't work for me, although maybe I just needed to wait longer for the cache to reload. Whatever the case, the spotlight privacy settings worked. My next question is: is it possible to tell alfred to ignore a folder in general search, but to not ignore when using a specific keyword? I have many articles on my computer that I don't want to sift through every time I use alfred, but I want to be able to search through them with a keyword "article." Does anyone have any ideas?

 

Is it a folder or the contents within the folder that you aren't wanting to see in default results? The reason I ask is, if it's the contents, what I would more suggest would be to turn off some of the additional items in the Default Results section of Alfred's prefs and have a workflow file filter to search just that folder and its contents. That way you don't get a bunch of random stuff in the default results and can then have keywords when you want to specifically target certain areas.

 

For instance, I only have Apps, Contacts, and Preferences shown in the default results, no folders. If I want to search folders, I have a file filter with the keyword set to a comma, that searches and shows ONLY folder results. Or if I had a workflow that was all work related content, I could create a file filter that would search ONLY that folder and it's contents.

Share this post


Link to post

Is it a folder or the contents within the folder that you aren't wanting to see in default results? The reason I ask is, if it's the contents, what I would more suggest would be to turn off some of the additional items in the Default Results section of Alfred's prefs and have a workflow file filter to search just that folder and its contents. That way you don't get a bunch of random stuff in the default results and can then have keywords when you want to specifically target certain areas.

 

For instance, I only have Apps, Contacts, and Preferences shown in the default results, no folders. If I want to search folders, I have a file filter with the keyword set to a comma, that searches and shows ONLY folder results. Or if I had a workflow that was all work related content, I could create a file filter that would search ONLY that folder and it's contents.

 

Sorry, I should have been more clear. It is the contents of the folder that I am interested in filtering. I thought of turning off all PDFs in the default results, but ideally I would be able to see some PDFs in the default results, just not the ones in one folder. This might not be possible, but my goal is to blacklist a particular folder (rather than a particular file type) from only the default results.

Share this post


Link to post

Sorry for reviving an old thread but this is the first Google result on the matter.

 

Would be awesome if there was a way to define a dynamic ignore. For example I'd like to ignore all node_modules folders which are created on every new JS project.

 

AFAIK there is not really a way to do that in Spotlight either, but it would be awesome if Alfred could solve this.

Share this post


Link to post
3 hours ago, pier said:

AFAIK there is not really a way to do that in Spotlight either

 

That's basically why it's impossible to do with Alfred, too.

 

Alfred uses the same metadata index and API as Spotlight, so suffers from many of the same limitations, including the "whitelist-only" approach, which is inherent to the API.

 

So for technical reasons, adding a blacklisting layer to Alfred would have a very significant impact on performance.

 

A blacklist has been requested many times, but the Alfred team has expressed reluctance for the above reason.

 

It sucks especially for folks with Node projects, as node_modules is basically Alfred's kryptonite. A Node project is effectively a worst-case scenario for the Spotlight/Alfred model.

 

Share this post


Link to post

I use Hazel to automatically add the alfred:ignore tag where needed (e.g. backup volumes).  A Hazel rule to add the tag to any folder named node_modules & its contents should be trivial to set up.

Share this post


Link to post
3 hours ago, dfay said:

A Hazel rule to add the tag to any folder named node_modules & its contents should be trivial to set up.

 

It's trivial to set up, but not necessarily a great idea.

 

There can be many tens of thousands of files in node_modules, and Hazel's help specifically warns against rules that would cause it to visit every file in such a large tree.

 

I think you'd be better off with a script that you can run as needed rather than having Hazel check every single file in node_modules every time something changes.

Share this post


Link to post
4 hours ago, deanishe said:

I think you'd be better off with a script that you can run as needed rather than having Hazel check every single file in node_modules every time something changes.

 

Would adding the alfred:ignore tag to a folder make Alfred ignore all the files and subfolders too?

Edited by pier

Share this post


Link to post
8 minutes ago, pier said:

Would adding the alfred:ignore tag to a folder make Alfred ignore all the files and subfolders too?

 

No. If it did, this would be easy to do…

 

The alfred:ignore tag only applies to the folder it's set on, not its contents.

 

Hazel, as @dfay recommended, is a great fit for the task of tagging all the files in general. But you have to be careful using Hazel with large directory trees and recursive rules (which you'd probably need in this case). You don't want Hazel checking 20,000+ files every time something changes in node_modules. Hazel's UI also isn't very good with large numbers of folders.

 

I think the "right" solution would be a post-install hook that tags just the package that changed/was added.

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...