Powershell folder size of folders without listing Subdirectories

后端 未结 10 2222
北海茫月
北海茫月 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:39

    At the answer from @squicc if you amend this line: $topDir = Get-ChildItem -directory "C:\test" with -force then you will be able to see the hidden directories also. Without this, the size will be different when you run the solution from inside or outside the folder.

提交回复
热议问题