HoudahSpot icon

Non-Recursive Search: Find Top-Level Files Only

HoudahSpot searches “recursively” descend into subfolders: results will include files from the folder where you are searching as well as files from folders nested within that folder.

In HoudahSpot you can list folders where you want to search. You can also exclude folders (and their subfolders) from the search: just drag the folder from the breadcrumb path at the bottom of the HoudahSpot window to the Locations/Exclude list.

In most cases, you want search results to include nested items. You have organized your files in a folder hierarchy and are using a search tool to find files anywhere in a folder tree of related files.

Sometimes you want to see only results from the top-level folder. You can repeat the above procedure to exclude more folders. Excluding all subfolders, one by one would be tedious. We will use a filter instead.

Example 1: Filtered Folder View

When you look at the contents of a folder, the Finder gives you tools to locate the desired file: you can sort files, you group files, you can add more columns to view file information. When looking for an image file, you can, for example, group files by kind and sort by date. This should make spotting the file easier.

What if you want only high-resolution image files? What if you are looking for a file by content? That does sound like a job for a file search tool. You just don’t want nested items to clog up your search results.

Let’s search for large images in ~/Pictures and focus solely on items at the first level of that folder. In other words, you want to filter the items at ~/Pictures so that you see only the high-resolution image files.

Start with a search:

  • Set the Locations to ~/Pictures
  • Refine for Pixel Count greater than 7’000’000

Find photos with more than 7MP

Filter the results to see only top-level files

  • Select Search > Filter Results… from the menu
  • Set a Folder filter for “is” “~/Pictures”

Filter: Immediate content of ~/Pictures folder

Run the search. HoudahSpot will show both the total number of results and the actual count of results shown.

Example 2: Organize Files. Apply Actions

You have set out to clean up and organize a large number of files in your Documents folder. In preparation, you have marked different categories of files with different tags: private files, work files, stuff to keep in place, to archive, to backup, etc.

Now you want to act on those tags and find you want to work on files that have both an “Orange” and a “Green” label. Again, this sounds like a task for a file search. The thing is you want to act only on top-level files and folders. You don’t want to rip files out of subfolders. You don’t know which files in these folders also have labels and what purpose those labels serve.

Let’s find top-level files tagged both “Orange” and “Green”

Start with a search:

  • Set the Locations to ~/Documents
  • In the Refine pane, add an “All” group
  • Indented within that group, add a criterion for Tags is Orange
  • Within the same group, add a criterion for Tags is Green

Find files tagged both Orange and Green

Filter the results to see only top-level files

  • Select Search > Filter Results… from the menu
  • Set a Folder filter for “is” “~/Documents”

Filter: Show only top-level documents

Run the search. The files and folders shown in the Results pane are those you want to act on. You can use the commands from the Results menu to copy or move these files. You can also drag the files to a folder or volume in Finder.