I was trying to recursively list using ls
all the *.py
files in a directory in Windows PowerShell. It didn't work. I checked up on the man
page and then online page that -Recurse
flag doesn't accept wildcards so *.py
wouldn't work.
I want to know whether there is a simple in-built way to recursively list the files of a particular file extension in a directory using Windows PowerShell 2.0?
I am a newbie in PowerShell and don't want to indulge in Shell scripting at this stage. So please recommend in-built commands, flags, etc. only, if any.
By commands I means the in-built keywords of the PowerShell. I am not sure if that is proper vocabulary for PowerShell.
Use the Filter parameter:
ls $path -filter *.py -recurse
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With