Search inside one folder only on a Mac
· 6 min read
Finder can search one folder instead of the whole disk, and it will do it every time once you change a single setting. Open the folder, press Cmd-F, then click the button carrying the folder’s name in the row that appears under the toolbar. If you want that to be the behavior from now on, set Finder to search the current folder by default.
The Spotlight window in the menu bar cannot be scoped to a folder at all, which is why this feels harder than it should.
Scope a search to the folder you are looking at
- Open the folder in Finder.
- Press Cmd-F. The window becomes a search window, and a row appears under the toolbar reading Search: This Mac, followed by the folder’s name.
- Type what you are looking for.
- Click the button with the folder’s name. The results redraw at once, limited to that folder and everything inside it.
If your toolbar has a search field, typing into it does the same thing: the scope row appears as soon as the first character lands. Either way, the important click is the folder name, and it is easy to miss because This Mac is selected and looks like a label rather than a choice.
You can click the folder name before or after typing. Finder keeps the term and re-runs the search against the new scope.
Make the current folder the default
Doing that click every time is the part people give up on. Change it once instead.
- In Finder, press Cmd-comma to open Finder Settings.
- Go to the Advanced tab.
- Set When performing a search to Search the Current Folder.
The third option, Use the Previous Search Scope, sounds convenient and is not: the scope becomes whatever you last happened to pick, so you never know what a search covers without looking. Pick one of the two definite answers.
If you genuinely search the whole Mac more often than a folder, leave it on This Mac and remember the folder button. There is no wrong choice here, only an undecided one.
Narrow further once you are inside the folder
Scoping to a folder is usually not enough on its own, because Finder searches file contents and metadata as well as names. Two controls fix that.
The suggestion menu under the search field. As you type, Finder offers rows such as Name matches: budget. Choosing it drops content matches and searches names only, which is almost always what you meant.
The plus button at the right of the scope row. Each click adds a criteria row: Kind, Last modified date, Created date, Name, Contents, and an Other entry that opens a long list including File extension, File size and System files. Adding System files set to are included is what makes files inside Library folders appear at all; without it Finder hides them even when the folder you scoped to is the one they live in.
Hold Option while clicking the plus and you get a row that switches between Any and All, which is how you build a search meaning “in this folder, a PDF or a Pages file, modified this month”.
One honest limitation: a Finder search of a folder always includes its subfolders, and there is no switch for one level only. If you want just the folder’s own items, look at the folder in list view and sort, or run find . -maxdepth 1 -name "*.pdf" in Terminal from inside it.
Save the search instead of rebuilding it
If you run the same scoped search weekly, stop retyping it.
- Build the search: scope, term, any criteria rows.
- Click Save at the right of the criteria row.
- Name it, and leave Add To Sidebar ticked.
You now have a smart folder that re-runs the query every time you click it. Smart folders live in ~/Library/Saved Searches and hold a query, not copies of files, so nothing is duplicated and nothing breaks if you move the originals.
The scope is baked in when you save, so build the search inside the right folder before you click Save.
The same job from the Terminal
Spotlight’s index is queryable from the command line, and folder scoping there is a single flag:
mdfind -onlyin ~/Documents invoice
mdfind -onlyin ~/Documents -name invoice
The first searches names, contents and metadata inside that folder. The second matches the name only. mdfind: searching a Mac from the Terminal covers the query syntax, dates and sizes, and how to pipe the results into other commands.
When the folder is not indexed at all, find still works because it walks the disk itself rather than consulting an index:
find ~/Documents -iname "*invoice*"
It is slower on a large folder and it does not care about Spotlight’s exclusions, which is exactly why it is useful as a second opinion.
When the folder is not the real problem
Sometimes a scoped search returns nothing because of something unrelated to scope.
The folder is excluded from indexing. Anything added to the privacy list in System Settings, Spotlight returns no results in Finder search either. Spotlight cannot find a file you know exists covers the order to check things in.
The folder is really a package. Items inside .app bundles or a Photos library are hidden from ordinary search. You reach them by right-clicking the package and choosing Show Package Contents.
It is on a network share. Server volumes are usually not indexed, so Finder falls back to a slow crawl, or to whatever search the server itself offers.
If folder scoping is something you do constantly, a search app that keeps its own catalog handles it as part of the query rather than as a mode. Everywhere reads every filename and path on the Mac once, then narrows as you type, and its path: operator does the scoping inline: typing invoice path:clients ext:pdf is one line rather than three clicks. It searches names and paths, not the text inside documents, so for a phrase you remember from inside a file, Finder’s Contents criterion or Spotlight remains the right tool.
Questions
Why does Finder keep going back to searching the whole Mac? Because the default in Finder Settings, Advanced is set to This Mac, or to Use the Previous Search Scope. Set it to Search the Current Folder and the folder button stops being a per-search chore.
Can I limit the menu bar Spotlight window to one folder?
No. That window searches everything it is allowed to see and offers no folder scope. Finder, a saved smart folder, or mdfind -onlyin are the ways to restrict it.
Does searching a folder include everything inside it? Yes, all the way down. Finder has no depth control, so treat a scoped search as “this folder and its whole tree”.
Why do files in my Library folder never show up? Finder excludes system files from search results by default. Add the System files criterion with the plus button and set it to are included, and they appear.