Count items in a folder with PowerShell

后端 未结 7 1338
闹比i
闹比i 2020-12-01 04:10

I\'m trying to write a very simple PowerShell script to give me the total number of items (both files and folders) in a given folder (c:\\MyFolder). Here\'s wh

7条回答
  •  离开以前
    2020-12-01 04:41

    Recursively count files in directories in PowerShell 2.0

    ls -rec | ? {$_.mode -match 'd'} | select FullName,  @{N='Count';E={(ls $_.FullName | measure).Count}}
    

提交回复
热议问题