반응형
PowerShell에서 복사할 파일 목록을 가져옵니다.
PowerShell을 사용하고 있습니다.Copy-Item
파일이 있는 디렉터리를 다른 위치에 복사하는 명령입니다.
복사 명령의 상태를 알 수 있도록 복사되는 콘솔의 모든 파일을 표시합니다.
콘솔에서 보기를 원하는 경우-verbose
스위치:
copy-item -path $from -destination $to -verbose
파일 또는 디렉터리 목록을 가져오려는 경우:
$files = copy-item -path $from -destination $to -passthru | ?{$_ -is [system.io.fileinfo]}
$source=ls c:\temp *.*
$i=1
$source| %{
[int]$percent = $i / $source.count * 100
Write-Progress -Activity "Copying ... ($percent %)" -status $_ -PercentComplete $percent -verbose
copy $_.fullName -Destination c:\test
$i++
}
파일 이름을 직접 출력하려면 다음 방법을 사용합니다.
경로 포함
Copy-Item -Path $from -Destination $to –PassThru | ForEach-Object { Write-Host $_.FullName }
파일 이름만
Copy-Item -Path $from -Destination $to –PassThru | ForEach-Object { Write-Host $_.Name }
다음과 같은 방법으로 시도해 볼 것을 제안합니다.
(Copy-Item -Verbose C:\SrcDir\*.* c:\DstDir 4>&1).Message
여기서 메시지는 자세한 스트림/파이프라인이 아닌 출력 스트림/파이프라인으로 이동하므로 TFS 작업 스크립트와 같이 보다 일반적으로 작동합니다.
언급URL : https://stackoverflow.com/questions/13815656/get-the-list-of-files-that-are-getting-copied-in-powershell
반응형
'programing' 카테고리의 다른 글
오라클 데이터베이스에서 날짜 형식 ddmmyyyy를 선택합니다. (0) | 2023.08.12 |
---|---|
Powershell: 일별 트리거 및 반복 간격이 있는 스케줄링된 작업 (0) | 2023.08.12 |
Pycharm/Python OpenCV 및 CV2 설치 오류 (0) | 2023.08.12 |
판다 사용 두 개의 서로 다른 Excel 파일/시트 결합/합병 (0) | 2023.08.12 |
메이븐 구성의 스프링 부트 (0) | 2023.08.12 |