$src = "D:\원본폴더"
$dst = "D:\모은파일"
New-Item -ItemType Directory -Force -Path $dst | Out-Null
$files = Get-ChildItem $src -Recurse -File
$total = $files.Count
$count = 0
foreach ($file in $files) {
$count++
Write-Progress -Activity "파일 복사 중..." `
-Status "$count / $total : $($file.Name)" `
-PercentComplete (($count / $total) * 100)
$target = Join-Path $dst $file.Name
if (Test-Path $target) {
$base = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
$ext = $file.Extension
$i = 1
do {
$target = Join-Path $dst "$base($i)$ext"
$i++
} while (Test-Path $target)
}
Copy-Item $file.FullName -Destination $target
}
Write-Host "완료! 총 $total개의 파일을 '$dst'에 복사했습니다."
흩어진 경험을 하나의 이야기로, 슈퍼점프와 함께 합격으로 가는 자기소개서를 빠르게 완성하세요!! 로그인 후 ‘내 정보 > 쿠폰’에서 SUPERJUMP를 입력하고 일주일간 무료로 체험해 보세요!
https://share.google/9Pe7tyMW8QqtqnLpj