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.
3 Answers
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.
1In 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:
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:~"*(*).*"
Again, the complete list is here:
Using Advanced Query Syntax Programmatically - Query Operators
See
name:"1-*.*"But the options on the search tab affect what will happen.
1