Currently I am using Alfred's filesystem navigation capabilities. It's pretty awesome, but sometimes I want fuzzy-search to match not only the filename but the full path.

E.g. I want to find a pdf file with some very common filename (say proposal.pdf). And I have a directory structure like this:

 - dropbox
   - partners
     - supercorp
       - proposal.pdf
     - megacorp
       - proposal.pdf

It would be nice if I can type dro/meg/propos to get to the megacorp's proposal file. The answer may be the Alfred plugin or some configuration, but I'll accept any solution that allows me to quickly navigate to this file and perform some action (e.g. reveal in Finder or something). "Search-as-you-type" functionality is very important.

UPD Just found a similar question. Seems that full path matching feature is missing because mdfind is only searching the file name and all the tools are using it internally.

  • Alfred can navigate the file system, with autocompletion. If you type ~, and then type dro, pressing Enter autocompletes Dropbox. Then meg would match megacorp, etc. That’s not quite path matching, but it might be useful. Once you’ve found the file in Alfred, press the right arrow key and you can access file actions.
    – alexwlchan
    Jul 18, 2013 at 20:48
  • Thanks, alexwlchan. Alfred's "File Navigation" feature is very useful and I use it a lot, while just "exploring" new directory structure. I need a matching in the case when I am already familiar with structure and want to go-to-things faster.
    – vbo
    Jul 18, 2013 at 22:13

7 Answers 7


Alfred ships with an example workflow called Dynamic File Search that does something similar to fuzzy searching:



Alfred searching through directories and filenames at the same time

To add it, click the [+] at the bottom of the Workflows preferences, and choose Examples > Dynamic File Search.

  1. Type "ff" in Alfred to first select a search scope
  2. Then type the name of the file you're searching for within that folder

More documentation on Alfred's file filter feature can be found here https://www.alfredapp.com/help/workflows/inputs/file-filter/


There is a kMDItemPath attribute, but it can't be used in queries. You can grep the output of mdfind though:

$ pp() { path="/${1%/*}/"; mdfind "name:${1##*/}" | grep -i "${path//\//.*\/}"; }
$ time pp desk/ante
/Library/Desktop Pictures/Antelope Canyon.jpg

Matching kMDItemFSName is often a lot slower:

$ time mdfind "kMDItemFSName=\"ante.*\"c" | grep -i '/desk.*/'
/Library/Desktop Pictures/Antelope Canyon.jpg

I tried creating a script filter like this in Alfred:


shopt -s nocasematch

amp() {
  local o=${1//&/&}
  printf %s "${o//>/&gt;}"

output='<?xml version="1.0"?>

while IFS= read -r l; do
  path=$(amp "$l")
<title>$(amp "${l##*/}")</title>
<icon type=\"fileicon\">$path</icon>
done < <(if [[ $q =~ .+/.+ ]]; then
  mdfind "name:${q##*/}" | while IFS= read -r l; do
    [[ ${l%/*} = */${dir//\/*/}* ]] && echo "$l"
  mdfind "kind:folder name:$q"
fi | head -n20)

echo "$output</items>

I couldn't get it to work relibaly though, and it often took multiple seconds to update the results.

  • Great answer. I also create a simple proof-of-concept script filter for Alfred, using mdfind | grep way. See gist. It's very far from ideal though. I'll try to use it on my own for some time to fix some bugs and maybe I come up with some improvements. But for now I don't think that this approach (or yours) can be used in the robust ready-made solution.
    – vbo
    Jul 23, 2013 at 9:22

You may try Findspot. Findspot supports these features

  1. Fuzzy search like Sublime Text's Control-P
  2. Full path search
  3. Search as you type

Here is a screenshot of Findspot when using your example:

enter image description here

Actually, you can skip the slashes and you will still get the same result.


Easy Find, free, from DevonTechnologies allows you to search files, folders or both, in anything from single folders or the entire disk - as well as use easily selected criteria: fuzzy, invisible, name, contents etc.

Hard to estimate how many hundred hours it's saved me over the years while Apple futzes with Spotlight and Saved Search. Finds, nearly instantly, anything.

  • I just tried Easy Find and found no way to match full file path - it matches only the filename like Alfred and Spotlight. Maybe I am missing something though.
    – vbo
    Jul 21, 2013 at 16:23
  • All the usual columns are there -- size, date, etc. -- sometimes they just need to be dragged wider. "Where" shows the path. Also, clicking on a column header sorts by.
    – Zo219
    Jul 22, 2013 at 22:32
  • Columns are there, but search matches only the filename. If I am wrong, please add a precise instructions on how to get it working.
    – vbo
    Jul 23, 2013 at 9:27
  • As far as search matching, that has to be set up in all the choices down the left side. Files and/or folders, visible or not, etc. Narrow down the location to search in the pull-down at top right that starts with hard disk name.
    – Zo219
    Jul 23, 2013 at 19:05

Add this in ~/.bash_profile (you can replace cd with open)

export PATH=$PATH:~/bin

  cd "$(find . -type d -maxdepth 3 | selecta)"

And add selecta from https://github.com/garybernhardt/selecta/blob/master/selecta into ~/bin

Now when you launch a terminal you can type cds and start searching!

AppleScript file to open iTerm and enter cds automatically: cds.applescript

activate application "iTerm"
tell application "System Events" to keystroke "t" using command down
tell application "iTerm" to tell session -1 of current terminal to write text "cds"

you can test the script using the command osascript cds.applescript You could even set up a keyboard shortcut to call it: http://www.macdevcenter.com/pub/a/mac/2007/06/08/hit-and-run-launching-applescripts-with-keyboard-shortcuts.html?page=1


I've been looking for the same thing for many years, and finally just came across GoToFile, which seems to be exactly what we're looking for!


Why u need fuzzy search in spotlight, if terminal is here? open dro[tab]meg[tab]prop[tab]

also you can configure your .bash_profile to additionals.

  • Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Answers should be self-contained so explain why you think the answer you provided will solve the problem or is better than others out there. Providing links as supporting information can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. - From Review
    – fsb
    Mar 19, 2017 at 0:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .