powershell 获取文件夹的大小

 

 

 

 

powershell 获取文件夹的大小

$startFolder = "C:\users"

  
$colItems = (Get-ChildItem $startFolder  | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object)
foreach ($i in $colItems)
    {
        $subFolderItems = (Get-ChildItem $i.FullName -recurse | Measure-Object -property length -sum)
        $i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"
    }

 

posted on 2023-10-10 10:15  stoneyeung  阅读(567)  评论(0编辑  收藏  举报

导航