Exclude sub-folders from Finder search

Use Unix find as follows

find . -maxdepth 1 -name config.txt -print

In Terminal, type man find for details.

If you do this often, you can make it into a shell function.


  1. There is a product called Path Finder 6 that offers a feature called "filters and selections," demonstrated here.

  2. You could try selecting all the items in the folder you are searching and applying a Label, then perform a Spotlight search for your item "AND" the additional criteria of "file label" by holding down the option key while clicking on the plus sign.


Possible workaround, although this doesn't really answer the question. Not sure if there's a built-in option for this.

  1. In list view, make sure all folders are collapsed --cmd-a (select all) and command-left-arrow are shortcuts for this.

  2. Without selecting the search box or using cmd-f, begin typing the name of the file "config.txt" and this will select that file in your current directory.