Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursive listing of a particular file type in Windows PowerShell

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.

like image 725
Aseem Bansal Avatar asked Jun 27 '13 09:06

Aseem Bansal


1 Answers

Use the Filter parameter:

ls $path -filter *.py -recurse
like image 62
Shay Levy Avatar answered Nov 15 '22 04:11

Shay Levy