Jump to content

Exclude folders and filetypes both globally and for file filters


deanishe

Recommended Posts

  • 2 months later...
1 hour ago, robertstrazz said:

A nice to have would be to make "open x" only return folders as results and not individual files.

 

This is trivial to do with a File Filter. You can also assign a much shorter keyword than open. Mine is f.

Link to comment
Share on other sites

@robertstrazz Following on from @deanishe's suggestion to use a file filter, here's a guide to creating your own file filter workflows:

https://www.alfredapp.com/help/workflows/inputs/file-filter/

 

You'll also find a pre-created file filter workflow built into Alfred in the Workflows preferences, press the + at the bottom of the sidebar > Examples > Simple Folder Search. :) 

 

Cheers,

Vero

Link to comment
Share on other sites

  • 3 years later...

I'm trying to understand the discussion so far, but I think I'm lost.

 

I can't seem to find regular expression matching or simple string matching e.g. "~some file.pptx".startswith("~") in the Alfred settings.

 

Is it true that Alfred does not and will not allow users to exclude items from the result by using string matching or regular expressions?

  • For example, I never want to see the Microsoft Powerpoint backup files that always start with the "~" character.
  • However, I do want to see the actual ".pptx" files.
  • I would like to tell Alfred that I don't want to see results that match this regex: ^~

 

 

Link to comment
Share on other sites

18 minutes ago, slowkow said:

Is it true that Alfred does not and will not allow users to exclude items from the result by using string matching or regular expressions?

 

Correct. The macOS search API is fundamentally include-only. You can exclude directories from being indexed in the first place (via Spotlight's "Privacy" pane), but there is no way to specify any sort of exclusion in a search.

 

This question was asked again more recently, and here's Andrew's explanation for why post-filtering results in Alfred isn't feasible:

 

 

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

I'm still a little confused after reading through this thread and others. I understand it isn't possible in normal results, but the suggestion to use File Filters keep popping up. So is it possible to exclude folders that match a string specifically in a custom File Filter workflow?

Link to comment
Share on other sites

@gills Yes it is. In the File Filter under the Fields tab, add a search field using the + button and click `kMDItemDisplayName`. Change the value from `{query}` to the string you want to match and click the checkbox under the NOT column. Now any folder name containing the string you specified will be excluded from the results of that File Filter.

 

See the documentation for the File Filter Input here, which might explain the Fields section a little better.

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