Drive size
페이지 정보

본문
# 실행 정책 설정
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# 검사할 드라이브 목록
$drivePaths = @("C:\", "D:\")
# 출력 파일 경로
$outputFile = "D:\Drive_folder_sizes_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
# 현재 날짜/시간 출력 시작
"폴더 용량 확인 - 실행 시간: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" | Out-File -Encoding UTF8 $outputFile
"" | Out-File -Append -Encoding UTF8 $outputFile
# 각 드라이브에 대해 실행
foreach ($drivePath in $drivePaths) {
"드라이브: $drivePath" | Out-File -Append -Encoding UTF8 $outputFile
"----------------------------------------" | Out-File -Append -Encoding UTF8 $outputFile
Get-ChildItem -Path $drivePath -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$folder = $_.FullName
$sizeBytes = (Get-ChildItem -Recurse -Force -File -Path $folder -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
$sizeGB = [math]::Round($sizeBytes / 1GB, 2)
"{0,-60} {1,10} GB" -f $folder, $sizeGB
} | Out-File -Append -Encoding UTF8 $outputFile
"" | Out-File -Append -Encoding UTF8 $outputFile
}
# 사용자 입력 대기
Read-Host "작업이 완료되었습니다. Enter 키를 누르면 닫힙니다."
###############
# 대상 드라이브 경로 설정
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$drivePath = "D:\"
$outputFile = "D:\D_folder_sizes.txt"
Get-ChildItem -Path $drivePath -Directory | ForEach-Object {
$folder = $_.FullName
$sizeBytes = (Get-ChildItem -Recurse -Force -File -Path $folder -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
$sizeGB = [math]::Round($sizeBytes / 1GB, 2)
"{0,-40} {1,10} GB" -f $folder, $sizeGB
} | Out-File -Encoding UTF8 $outputFile
Read-Host "작업이 완료되었습니다. Enter 키를 누르면 닫힙니다."
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# 검사할 드라이브 목록
$drivePaths = @("C:\", "D:\")
# 출력 파일 경로
$outputFile = "D:\Drive_folder_sizes_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
# 현재 날짜/시간 출력 시작
"폴더 용량 확인 - 실행 시간: $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" | Out-File -Encoding UTF8 $outputFile
"" | Out-File -Append -Encoding UTF8 $outputFile
# 각 드라이브에 대해 실행
foreach ($drivePath in $drivePaths) {
"드라이브: $drivePath" | Out-File -Append -Encoding UTF8 $outputFile
"----------------------------------------" | Out-File -Append -Encoding UTF8 $outputFile
Get-ChildItem -Path $drivePath -Directory -ErrorAction SilentlyContinue | ForEach-Object {
$folder = $_.FullName
$sizeBytes = (Get-ChildItem -Recurse -Force -File -Path $folder -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
$sizeGB = [math]::Round($sizeBytes / 1GB, 2)
"{0,-60} {1,10} GB" -f $folder, $sizeGB
} | Out-File -Append -Encoding UTF8 $outputFile
"" | Out-File -Append -Encoding UTF8 $outputFile
}
# 사용자 입력 대기
Read-Host "작업이 완료되었습니다. Enter 키를 누르면 닫힙니다."
###############
# 대상 드라이브 경로 설정
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$drivePath = "D:\"
$outputFile = "D:\D_folder_sizes.txt"
Get-ChildItem -Path $drivePath -Directory | ForEach-Object {
$folder = $_.FullName
$sizeBytes = (Get-ChildItem -Recurse -Force -File -Path $folder -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum
$sizeGB = [math]::Round($sizeBytes / 1GB, 2)
"{0,-40} {1,10} GB" -f $folder, $sizeGB
} | Out-File -Encoding UTF8 $outputFile
Read-Host "작업이 완료되었습니다. Enter 키를 누르면 닫힙니다."
- 이전글이 PC는 보안 부팅을 지원 해야 합니다 25.06.12
- 다음글리눅스 특정 폴더 內 파일 갯수 25.05.21
댓글목록
등록된 댓글이 없습니다.
