File Filter Input
File filter workflows are a fantastic way to create filtered searches where you specify the file types you want Alfred to search and/or the locations you want him to search in.
- Why create a file filter?
- Examples Using File Filters
- Creating your own File Filter Workflows
- Download an example workflow
Why create a file filter?
A file filter allows you to narrow down your search to particular file types you want to find, making it easier to locate the file you need.
Rather than add every possible file type to your default Alfred results, or trawl through an unfiltered list of all files that match your search term, these finely focused filters will help you find the results you need in a moment.
In the file filter input, you can specify:
- the file types searched
- the search scope within which Alfred should search
- a date range (today, last 3, 7 or 30 days, or older than 30 days)
- which fields to search (e.g search based on OS X tags you've added or document author name)
You can then trigger the file search using a keyword or a hotkey.
Examples Using File Filters
The simplest use for it is to connect this workflow item to an "Open file" action to filter for folders only and open them in Alfred. Optionally, set an "Open with" application in the "Open file" action to open these files in an app other than the standard one (e.g. open photos in your photo editing software instead of Preview.app)
The placeholder title and subtitle is displayed in Alfred's results until the File Filter search query text returns results.
Placeholder text is no longer required, but is recommended. The placeholder title and subtitle appear until you start typing your actual search query text. Without a placeholder, your filter will still work, but will not appear until you start typing your search query text.
You can either drag files of the type you want to search into the File Types box, or type their UTIs (Uniform Type Identifier) in.
You can specify a search scope by dragging one or many folders into the Search Scope tab.
Only check the box to show files marked as System File if you really need to include these, as they'll otherwise add noise (and seemingly strange files) to your results.
- Set a date range to limit the age of the files you're searching
- Customise the metadata fields Alfred searches (e.g. If you've used OpenMeta tags)
- Change anchoring to broaden the search with wildcarding
Creating your own File Filter Workflows
Below, you'll find an example workflow created to search for PDFs in your Documents folder.
You'll also find a tutorial on creating a file filter workflow on the blog; You'll learn how to create a search for images which then opens your chosen result in Safari, and how to add a hotkey so that you can trigger the search with a custom hotkey.
Creating your own File Filter Workflow
In this example, let's create a file filter that searches only for PDFs in your Documents folder. If you're searching the contents of this folder every day, it makes it much quicker to create a search like this rather than manually navigating into the folder every time.
Launch Alfred's preferences to the Workflows tab
Click the + button in the bottom left of the preferences and select Templates > Files & Apps > File filter from keyword and open. Give your workflow a name and a bundle ID.
Double-click the File Filter object to make the dropdown appear
Set your keyword to "pdf" and add a title (e.g. "PDF File Searcher") and some subtext that explains what the workflow will do
- Drag a PDF file to the "File types" box so that Alfred knows you want to search for PDF files only.
You could now save your workflow and be all done, but let's add a few more improvements.
Optionally, you can set an icon for your workflow by dragging a pdf file or an icon of your choice to the image well that says "Drop an icon above".
- Want to set the search scope to only search specific folders? Go to the Advanced tab and drag in the folders you want to search in this workflow. Here we'll add the Documents folder, but you can add as many as you like or leave it blank to use your default Alfred search scope.
Click the save button.
- Want to give your workflow a clearer name? Double-click the workflow in the left sidebar to set a name and a description, then click Save.
Now launch Alfred and type "pdf" followed by your keyword and you will see that only folders will appear in your filtered search.
Congratulations, you've created your first workflow! You can now create filters like this but drag different file types to filter only folders, images, text files and more.
Download an Example File Filter Workflow
Download the PDF File Searcher workflow to see how you can easily create your own file filters and search your Mac more efficiently.