Jump to content

File search restricted by file type


mlevison

Recommended Posts

I love the keywords in, open and find. They're the part of Alfred I use multiple times a day.

 

There is one limitation I see and I'm curious if there is a clever way round it. Sometimes when I search I realize that I'm finding alot of files not all of which are important in the context. Usually I know that the information is in a specific file type (word, excel, pdf, txt/markdown). Without creating a whole bunch of new search keywords is there a way to filter? Perhaps a keyword like kind:xls or kind:pdf?

Link to comment

@mlevison Beyond Vitor's suggestion of File Filters (which is the best way to create easy to re-use filters), you can also just include "*pdf" in your query.

 

E.g. "[spacebar]tax*pdf"

 

  • The spacebar is the shortcut for the "open" keyword, broadening your search file types
  • "tax" as I'm looking for a tax document in this example
  • "*pdf" (of your choice of file type) where the star wildcards something before it and is a pdf

This is useful for quick one-off searches, but Vitor's suggestion is best for frequent searches, e.g. if you find that you're regularly needing to find PDFs in a fixed set of locations, you'll save a lot of time creating a File Filter workflow :)

 

Cheers,
Vero

Link to comment

@vitor thanks. The trouble I have with file filters is two fold:

- cognitive load - I already 3 page list of shortcuts and tricks to memorize so that my fingers stay on the keyboard, a modifier to existing trick is easier to remember than a whole new one

- by the time I realize I need to filter for a filetype I'm already staring at mess of file types and then I realize I could use a modifier.

 

@Vero didn't know I could use regex or at least wildcards that helps.

 

In the long run would you consider adding an operator like kind - it would be applicable to: ', in and find. It would save users having to create/memorize even more search function.

Link to comment

I currently use all 3 builtin search functions in Alfred. (Way cool thanks).

 

Filefilters impose M*N problem:

- 3 search types

- 4-5 filetypes (pdf, docs, spreadsheet, picture, ... the player to be named later)

 

That's 12+ searches to memorize.

 

If the amazing creators adopt a syntax similar to spotlight then I only need remember 3+4. Furthermore since kind is already a spotlight keyword, new users will have slightly easier time getting into Alfred.

 

Final point on the effort/cognitive load front. I don't usually realize I need to filter until I start typing "in" and it brings up a mess of files I'm not interested in. By then I would need to return to the beginning of the buffer to change my search.

 

Bonus round: The same approach would allow me to append keywords for "date" or "less 30 days old", ... -- the key takeaway is that is fun to narrow down your search list after you start typing.

 

Double bonus - I just realized the "*pdf" doesn't work if the keyword is "in"

 

Cheers

Mark

 

Link to comment
  • 10 months later...

 

On 9/14/2021 at 5:20 PM, mlevison said:

Double bonus - I just realized the "*pdf" doesn't work if the keyword is "in"

 

 

Any update on this? I'm specifically also looking to be able to search within files e.g. .md files. From what I could read file filter does not do this and as @mlevison wrote you can't narrow the search when using the "in" term. 

Link to comment
4 hours ago, nesdroc said:

I'm specifically also looking to be able to search within files e.g. .md files. From what I could read file filter does not do this

 

It does. On the Basic Setup tab of the File Filter, drop a markdown file on the File Types area. Then go to fields and [+]kMDItemTextContent, which search inside files.

Link to comment

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