任何建议都将受到赞赏。
这一直有效,直到我输入if exists来检查文件是否在目标目录中。 总体: 我想:
第3项 的代码无效(在 @echo之后“复制文件”)
代码:
FOR /F "tokens=*" %%a IN ('type %~dp0list.txt') DO (
if exist "%Dest_Dir%\%%a" (
@echo File Found
ren "%Dest_Dir%\%%a" %%a.%DATE_VAR%.RFC#_%number%.bkup
Set "backup=1"
) else @echo no file exits
@echo
@echo "Copying file"
FOR /R "%SEARCH_DIR%" %%f IN (*%%a*) DO (
@echo "inside Copying file " %%f
SET "SRC=%%~dpf"
SET DEST=!SRC:%SEARCH_DIR%=%DEST_DIR%!
xcopy /S /I "%%~f" "!DEST!"
)
)
If "backup"=="1" (
@echo *INSIDE MOVE*
Rem Copy "%Dest_Dir%\*.*.*.*.bkup" "%ARCHIVE_DIR%\*.*.*.*.bkup"
Copy "%Dest_Dir%\*bkup" "%ARCHIVE_DIR%\*bkup"
Del "%Dest_Dir%\*.*.*.*.bkup"
SET "backup=0"
)