0

For example, i have two files:

Textfile1.txt
Textfile2.txt

where first file is empty, and second contains string file1

Can I create a search query in standard windows explorer to match Textfile2.txt only? I mean file1 query will match both files, first because its name contains this string and second because it has this string as its content.

1
  • 1
    (Not Windows 8, therefore a comment) Normally name:Textfile1 is your solution, but: The problem even when partial matches are enabled, the search only shows partial matches if they are from the file name beginning. name:Text works - but name:file or name:*file* doesn't. Maybe the Windows 8 search with Bing is improved in this regards. In W7 its terrible and most people use third-party tools like everything
    – nixda
    Dec 15, 2014 at 13:40

2 Answers 2

2

You can use content keyword to search in content only, not file name:

content:file1
0

Other Advanced Query Syntax (AQS) keywords are:
type:
extension:
folder:
attributes:

Also, you can use a negating operator - on any/all of them and, since it doesn't appear to be anywhere else on the internet, I thought I'd include this little tidbit here.

To search for all files with NO extension but EXCLUDING specific folder(s), simply put this in the address bar in windows explorer inside the target folder to search:

`type:-[] extension:[] kind:-folder -folder:"\.git\*" -folder:"\.git"`

I feel this deserves an explanation of what's going on here, so that you may expand/morph this search to your needs.

Type is not nothing (everything). Extension is nothing (no extension). Kind is not folder (files). Exclude all subfolders/files in '.git' AND exclude the '.git' folder/files. I found that if a folder name has anything other than just alphanumeric characters, it has to be excluded twice, explicitly, once for all subfolders and once for the folder itself, otherwise Windows will still interpret that folder as a file and pick up results within it, thus my research into how to exclude '.git*' from my search. ;-)

Also, please note that excluding one or the other from the search bar will NOT exclude everything within that folder, nor will applying the trick I outline below (i.e. -folder:"\.git*\*"). Any other regularly named alphanumeric-only folders will be excluded just fine, e.g. -folder:"\java\*" will exclude the java folder/files AND all files/subfolders within java.

I also found other wildcards worked as expected inside the quotes, such as -folder:"\Swift*\*" to exclude Swift-5.0.xx folders (I also had to include this one twice, for the above reason). This narrowed my search for extensionless files from over 4,700 down to just 5. I thought maybe someone else might find this useful one day. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.