develop/windows

Windows 10,11 에서 폴더별 용량 확인 스크립트

인드라17 2025. 1. 15. 15:26

출처: https://zeliard.tistory.com/entry/win10-11-check-capacity-of-each-folder

PS (Power Shell) 관리자 모드에서 실행

$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