3

I would like to get all the files of an specific extension within a specific subfolder/s but that can be located at any level within a file system, for instance

Get-ChildItem ".\Source\**\Release\*.nupkg" -recurse

The simple asterisk works but searching on the immediate level under Source, but does not looks deeper in the tree.

I am looking to get this list of files from the command:

.\Source\Level1\Release\a.nupkg
.\Source\Level1\bin\Release\b.nupkg

Is there any way to achive this?

UPDATE

The answer of @JaredPar worked like a charm!. But my ouput is:

Directory: D:\Source\Level1\Release

ode LastWriteTime Name --- ------------- ---- a--- 08/23/2013 16:02 a.nupkg

Directory: D:\Source\Level1\bin\Release

ode LastWriteTime Name --- ------------- ---- a--- 08/23/2013 16:02 b.nupkg

I need to get one list with all the files, not grouped by directory, as in:

ode LastWriteTime Name --- ------------- ---- a--- 08/23/2013 16:02 a.nupkg a--- 08/23/2013 16:02 b.nupkg

4

1 回答 1

3

尝试以下

gci -re -attribute Directory Release | 
%{ gci $_ -re -in *.nupkg }

第一个命令将在当前路径下查找名称为 Release 的所有目录值。然后,您可以在这些路径下专门搜索 *.nupkg 文件

于 2013-08-26T14:54:15.537 回答