How can I search for files in the Windows command line, using wildcards like this?
Windows PowerShell can do this easily.
If you want to include subfolders:
Get-ChildItem C:\Users\*\AppData\Local\*.txt -recurse
Regarding Hidden (etc.) files, Powershell's
help Get-ChildItem says:
By default, Get-ChildItem gets non-hidden items, but you can use the Directory, File, Hidden, ReadOnly, and System parameters to get only items with these attributes. To create a complex attribute search, use the Attributes parameter. If you use these parameters, Get-ChildItem gets only the items that meet all search conditions, as though the parameters were connected by an AND operator.
Any good Unix shell for Windows will do this.
For example, here's a screenshot of my Hamilton C shell doing your example (sorry, no matches) and a couple others that do produce matches. The
... wildcard used in the third example matches zero or more directory levels, whatever it takes for the rest of the pattern to match.
And here's how you might do it with Cygwin
bash. A few differences here because Cygwin follows Unix conventions: Paths are usually typed with forward slashes and the backslash is the escape character. Since Unix doesn't understand drive letters, they've introduced a
/cydrive/c notation to refer to the
C: drive. As on Unix, wildcarding is case-sensitive. And while it supports the usual multiple directory level wildcarding you'd like, it doesn't include the
... I added to my shell. (Instead, you'd probably use
In cmd, navigate to
C:\Users, and run
dir /s /b | findstr AppData\Local | findstr txt
dir /s lists all files recursively,
/b displays full path, and within all these child files, use pipeline operator to search both the string 'AppData\Local' and 'txt'.