79 lines
2.0 KiB
Batchfile
79 lines
2.0 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "source_prefix=src\main\webapp\"
|
|
set "target_prefix=C:\Users\dbnt\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\geoinfo_eGov_work\"
|
|
set "target_directory=D:\git\dbnt\geoinfo.or.kr\geoinfo_eGov_work\"
|
|
|
|
echo --- File Copy Script Start (Robust Version) ---
|
|
echo.
|
|
|
|
rem for 루프는 각 줄을 서브루틴으로 넘기는 역할만 수행
|
|
for /f "delims=" %%i in (list.txt) do (
|
|
call :processLine "%%i"
|
|
)
|
|
|
|
echo.
|
|
echo --- All operations completed. ---
|
|
pause
|
|
goto :eof
|
|
|
|
|
|
rem ======================================================
|
|
rem :processLine 서브루틴 - 실제 파일 처리 로직
|
|
rem ======================================================
|
|
:processLine
|
|
set "line=%~1"
|
|
|
|
rem 루프 시작 시 변수 초기화
|
|
set "source_file="
|
|
set "target_file="
|
|
set "relative_path="
|
|
|
|
rem #으로 시작하는 주석 라인 건너뛰기
|
|
if "!line:~0,1!" == "#" (
|
|
echo [SKIP] Comment: !line!
|
|
goto :eof
|
|
)
|
|
|
|
echo [PROCESS] !line!
|
|
|
|
rem .java 파일 건너뛰기
|
|
if "!line:~-5!" == ".java" (
|
|
echo [SKIP] Java source file.
|
|
goto :eof
|
|
)
|
|
|
|
set "source_file=%target_directory%!line!"
|
|
set "relative_path=!line:%source_prefix%=!"
|
|
|
|
rem .xml 파일은 WEB-INF\classes 경로로 처리
|
|
if "!line:~-4!" == ".xml" (
|
|
set "relative_path=!line:*src\main\resources\=!"
|
|
set "target_file=%target_prefix%WEB-INF\classes\!relative_path!"
|
|
) else (
|
|
rem 그 외 모든 파일 처리
|
|
set "target_file=%target_prefix%!relative_path!"
|
|
)
|
|
|
|
rem --- [수정된 부분] 파일 복사 실행 및 결과 출력 ---
|
|
if defined source_file (
|
|
if exist "!source_file!" (
|
|
echo [COPY]
|
|
echo FROM: "!source_file!"
|
|
echo TO: "!target_file!"
|
|
xcopy /i /Y "!source_file!" "!target_file!" > nul
|
|
|
|
rem xcopy 성공 여부 확인 (errorlevel이 0이면 성공)
|
|
if !errorlevel! == 0 (
|
|
echo -> SUCCESS
|
|
) else (
|
|
echo -> FAILED (Error Code: !errorlevel!)
|
|
)
|
|
) else (
|
|
echo [ERROR] Source file not found: "!source_file!"
|
|
)
|
|
)
|
|
|
|
echo.
|
|
goto :eof |