On 6/10/23, Thomas Passin via Python-list <python-list@python.org> wrote: > > Yes; I didn't want to get too esoteric with commands that are hard to > figure out and remember, because then why not use Powershell, whose > commands are hard to figure out and remember?
Using `dir /s [/ad] [/b] "[path\]pattern"` with a wildcard pattern is a simple way to recursively search for a filename or directory, without needing to pipe the output to a findstr/grep/awk command. It's also fast. Of course, CMD's wildcards aren't nearly as powerful as regular expressions. The examples I included with `for` loops in CMD were for completeness to show how to get the results in a loop variable for further processing in a batch script. Personally, I use `for` loops a lot even when working at the command prompt, but I'm a dinosaur in that regard. Using PowerShell really should be preferred nowadays. -- https://mail.python.org/mailman/listinfo/python-list