Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- nodejs
- log4j2
- database
- tibero
- BPMN
- useEffect
- docker
- VSCode
- IntelliJ
- jetbrains
- MySQL
- springboot
- Git
- mybatis
- gradle
- NCP
- nginx
- LOG4J
- Windows
- gson
- Spring
- Kubernetes
- wildfly
- react
- JavaScript
- JPA
- Java
- kubectl
- dbeaver
- intellijIDEA
Archives
- Today
- Total
두 손끝의 창조자
PowerShell에서 현재 디렉토리들의 크기 구하기 본문
$directories = Get-ChildItem -Directory | Sort-Object {
try {
$_ | Get-ChildItem -Recurse -Force -ErrorAction Stop | Measure-Object -Property Length -Sum | Select-Object -ExpandProperty Sum
}
catch {
0
}
} -Descending
foreach ($directory in $directories) {
try {
$size = Get-ChildItem -Recurse -Force -LiteralPath $directory.FullName |
Measure-Object -Property Length -Sum |
Select-Object -ExpandProperty Sum
$formattedSize = "{0:N2}" -f ($size / 1MB) # Convert to megabytes and format the size
Write-Host "Directory: $($directory.Name), Size: $formattedSize MB"
}
catch {
Write-Host "Failed to retrieve size for directory: $($directory.Name)"
}
}
반응형
Comments