을 사용하여 파일 복사 : 재귀 적으로 내부 디렉토리 외부의 디렉토리 구조가 배치 파일
Dir1
--Dir2
--File1
--File2
--Dir3
--File3
--File4
--File5
은 이제 배치 파일을 사용하여 부모 디렉토리있는 Dir1에 서브 디렉토리 (Dir2라는, Dir3)에있는 모든 파일을 복사합니다. 아래 코드를 생각해 냈지만 완벽하게 작동하지 않습니다.
Directory2 --It has 4 files all together
Invalid number of parameters
Invalid number of parameters
Does E:\Directory1\Copy\File1.dat specify a file name -- And only this file gets copied
or directory name on the target
(F = file, D = directory)?
코드 - - 배치 파일에 대한
@echo off
call :treeProcess
Pause
goto :eof
:treeProcess
rem Do whatever you want here over the files of this subdir, for example:
for /D %%d in (*) do (
echo %%d
cd %%d
for %%f in (*) do xcopy %%f E:\Movies\Copy\%%f
call :treeProcess
cd ..
)
exit /b
내가 대부분 이것에 대한 한 줄 명령을 사용하여 ... 있는 Dir1> XCOPY *. */s Dir1 – Kingk