Powershell folder size of folders without listing Subdirectories

后端 未结 10 2215
北海茫月
北海茫月 2021-01-30 21:40

I have found several resources that use the following script to get folder sizes

$colItems = (Get-ChildItem $startFolder -recurse | Where-Object {$_.PSIsContaine         


        
10条回答
  •  伪装坚强ぢ
    2021-01-30 22:22

    My proposal:

    $dir="C:\temp\"
    get-childitem $dir -file -Rec | group Directory | where Name -eq $dir | select Name, @{N='Size';E={(($_.Group.Length | measure -Sum).Sum / 1MB)}}
    

提交回复
热议问题