관리자 권한으로 PowerShell을 실행하고 아래 스크립트를 실행한다.

 
$unitFactor = 1MB
$unitLabel = "MB"
Get-ChildItem . -Directory | ForEach-Object {
    $folderPath = $_.FullName
    $folderSize = (Get-ChildItem -Path $folderPath -Recurse -File | Measure-Object -Property Length -Sum).Sum
    [PSCustomObject]@{
        FolderName = $_.Name
        FolderSize = [Math]::Round($folderSize / $unitFactor, 2)
        Unit = $unitLabel
    }
} | Sort-Object FolderSize -Descending | Format-Table -AutoSize

아래와 같이 결과가 나온다.

 
FolderName          FolderSize Unit
----------          ---------- ----
Windows               43176.91 MB
Program Files         33170.97 MB
Program Files (x86)   26081.94 MB
Users                 26030.42 MB
chrometemp              176.09 MB
Python27                 66.21 MB
Temp                       0.7 MB
PerfLogs                     0 MB
inetpub                      0 MB

+ Recent posts