The Windows 7 search dropdown always searches within sub folders, but I only want to search the current folder. How can I do this?


A way to do this (in Windows 7) is to discard all subfolders using -folder: with \*, for example (when searching for .zip files inside the downloads folder):

*.zip -folder:"Downloads\*"

That's all.

  • 3
    Or to generalize to any current directory: *.zip -folder:".\*"
    – protongun
    Dec 29 '14 at 23:41
  • 2
    NVM, the above doesn't work as expected. Perhaps someone can offer a correction?
    – protongun
    Dec 29 '14 at 23:47
  • *.zip -folder:".\*" also excludes the current directly (as well as sub-directories). The above example works correctly to only exclude all sub-directories if "Downloads" is the current working directly.
    – ashtonium
    Feb 4 '15 at 16:59
  • 1
    @Xzila Its thanks to the trailing slash, let me give you a simple example, if we have the file "foo.zip", what is its folder? its folder is "C:\Downloads", it is NOT "C:\Downloads\", so when you do "-folder:"Downloads\*" it matches the later but not the former, effectively excluding only subdirectories Aug 27 '16 at 14:27
  • 1
    unix/Linux users, think carefully, "-folder:" is exclude the matching folder, negating the "folder:" clause. Semantic overload leaking in from the find command strikes again.
    – BenPen
    Nov 8 '16 at 20:02

to ignore folders (not their contained files), then try:

  • 3
    This works on Windows 10
    – Matthew
    Oct 8 '18 at 3:16

-folder:(name_of_subfolder) will exclude "name_of_subfolder" from the search results.

On the Microsoft website, see Advanced Query Syntax for more options (some of which may be outdated), and Advanced tips for searching in Windows which uses a newer syntax such as System.Kind:<>picture, but seems to be less complete.

  • This sort of parameter is exactly what I was looking for!
    – NiteCyper
    Nov 17 '14 at 13:11
  • 1
    @NiteCyper, did it work for you in Windows 7? (I am not on Windows, but it seems the parameter is outdated? See the links I added to the answer.)
    – Arjan
    Dec 14 '14 at 9:43
  • For future readers: it seems that System.FileName can also match directory names, so then maybe System.FileName<>name_of_subfolder would work. Also, System.Kind might allow for System.Kind:<>folder to exclude all folders (or when combined with System.FileName specific folders?). And it seems one might use this long list in search. (But: I am not using Windows.)
    – Arjan
    Dec 14 '14 at 9:51
  • @Arjan Yes, I use Windows 7. Windows 7 seems to have automatically removed the colon.
    – NiteCyper
    Dec 16 '14 at 0:18

In order to not search in sub-folders, in the search window, click "organize" (upper left corner) and select the option "Folder and search options." In that window, select the "Search" tab. Unselect the the option "Include subfolders in search results..." That will do the trick!

  • 1
    That will NOT do the trick. And that is a rotten glaring DANGEROUS bug in Explorer. Think Search -> Ctrl-A -> Delete. Subfolders are ALWAYS searched from the Explorer search box.
    – user350381
    Jul 26 '14 at 23:08
  • 1
    Nick is most definitely wrong. In Windows 7 this works.
    – R-D
    Aug 1 '14 at 11:26
  • 6
    This is a permanent change for a casual/ephemeral search, it doesn't make any sense to do this. Dec 16 '14 at 9:02

*.zip folder:"\MyFolder"

This must be run from the parent folder to search MyFolder, but none of MyFolder's sub-folders or sibling folders. The double quotes and the leading backslash appear to be required. I tested this on Windows 7 and it worked. I found this answer here: answers.microsoft.com: how do I NOT search subdirectories

While I found the excluding folder option from another answer worked (thanks), if you have a lot of subfolders to exclude, this option is likely easier.

  • On Windows 8, I was also able to run this from within the directory to be searched. E.g., in C:\foo, enter *.zip folder:"\foo" in the search box. Thanks for the info and link!
    – cxw
    Sep 1 '17 at 13:50

In Windows 10, you can select Current Folder in the Ribbon toolbar

enter image description here


I'm on a Windows 10 machine, but I doubt whether things have changed. If I'm right the above answers are wrong.

In the search box

If you go:
... this brings up all files and folders with the substring "common" followed by the substring "source": e.g. commons-collections4-4.0-sources.jar

NB For some unaccountable (Micro$oft) reason, even if you have set the thing NOT to search for file contents in "Advanced options", it will still search the contents of files if you don't precede the search string by "name:" or "filename:"

If you go:
name: common*source
... nothing comes up!

If you go:
filename: common*source
... this brings up all files and folders with the substring "common" followed by the substring "source": e.g. commons-collections4-4.0-sources.jar

If you go:
filename: common
... it will bring up all files and folders which have "common" in their name.

If you go:
filename: common -folder
... it will bring up only files (no folders) with "common" in their name

Note the difference between "name" and "filename". I suspect that in the first case it is using a "property" of the file hidden somewhere, and that most of the time you will want to be searching for "filename".

Also note that use of the wildcard * requires that the part before it precedes the part after it (of course). If you want these substrings to appear in your filename in any order it's a bit tricky. You have to do something like this:

filename: "*test*" AND "*co*" -folder

... which is equivalent to this:

filename: "*co*" AND "*test*" -folder

or indeed this:

filename: "*test*" + "*co*" -folder