Limit Get-ChildItem recursion depth

后端 未结 6 1237
清酒与你
清酒与你 2020-11-30 01:21

I can get all sub-items recursively using this command:

Get-ChildItem -recurse

But is there a way to limit the depth? If I only want to rec

6条回答
  •  余生分开走
    2020-11-30 01:29

    As of powershell 5.0, you can now use the -Depth parameter in Get-ChildItem!

    You combine it with -Recurse to limit the recursion.

    Get-ChildItem -Recurse -Depth 2
    

提交回复
热议问题