Windows 10 Explorer Search field: Search for files beginning with "1-"

I am looking for the pattern to use the windows explorer search bar to find all files (Not folders) in the current directory and all sub directories that start with the pattern 1- for example the file 1-file.txt should be found but the file 1file.txt not

I tried several syntax approaches that I know from GNU Grep or SED.

But the windows search bar always returns non sense, like files that just contain the number 1 somewhere in the filename.


Solution 1:

Are you open to using 3rd party tools? If you are, Everything by voidtools.com is pretty good and has very fast search capability. The tool indexes your whole computer and show you result as you typed.

Solution 2:

In some delightfully hard-to-find MS Documentation, there's information regarding several string-specific query operators. One of them is COP_VALUE_STARTSWITH:

Operator: COP_VALUE_STARTSWITH
Symbol: ~<
Example: System.FileName:~<"C++ Primer"
Description: Finds items where the file name begins with the characters "C++ Primer".

So, to find only files that begin with "1-", use:

FileName:~<1-

Other operators include:

  • COP_VALUE_ENDSWITH: ~>
  • COP_VALUE_CONTAINS: ~= or ~~
  • COP_VALUE_NOTCONTAINS: ~!
  • COP_DOSWILDCARDS: ~

VALUE_CONTAINS overcomes the default word-based (as opposed to character-based) nature of Windows Indexing. Using name:~~cess:

enter image description here

DOSWILDCARDS allows the wildcard characters ? and * to be used in quoted strings. And characters that are part of seach syntax, such as (, ), [, and ], must be in quotes to interpreted as search characters. So to find files that have parenthetical indices at the end of the filename, use FileName:~"*(*).*"

enter image description here

Again, the complete list is here:

Using Advanced Query Syntax Programmatically - Query Operators