Develop/PowerShell

[PowerShell] 특정 폴더 용량 확인

Codit Develop 2022. 2. 22. 13:41
반응형

PowerShell 폴더 용량 확인

PowerShell Command

# Target Directory : C:\vaults

# $GetDir = Get-ChildItem [DIRECTORY_PATH] -recurse | Measure-Object -property length -sum
$GetDir = Get-ChildItem C:\vaults -recurse | Measure-Object -property length -sum
$GetDirSize = $GetDir.Sum

Write-Host $GetDirSize

PowerShell One line command

# Target Directory : C:\vaults

# $GetDirSize = (Get-ChildItem [DIRECTORY_PATH] -recurse | Measure-Object -property length -sum).Sum
$GetDirSize = (Get-ChildItem C:\vaults -recurse | Measure-Object -property length -sum).Sum
Write-Host $GetDirSize

# or

# Write-Host (Get-ChildItem [DIRECTORY_PATH] -recurse | Measure-Object -property length -sum).Sum
Write-Host (Get-ChildItem C:\vaults -recurse | Measure-Object -property length -sum).Sum
반응형