tags:

views:

251

answers:

1

Here is the snippet. %%X is the source path. I want to replace the source path with destination path or just remove the source path.

%_DEST%\%%X is not working in this snippet... where it checks to see if the destination file already exists. What is the proper way to check to see if the destination file exists?

call :LOGMSG Copying new jpeg image files
for %%X in (%_SRC%\*.jpeg) do if not exist %_DEST%\%%X (
    xcopy %_SRC%\%%X %_DEST% /defy >>"%run_log%"
    call sd.exe add %%X >>"%run_log%"
)
+1  A: 

Use ~n in the variable to get rid of the path part. Also, you don't need %_SRC\% in the xcopy line:

call :LOGMSG Copying new jpeg image files
for %%X in (%_SRC%\*.jpeg) do if not exist %_DEST%\%%~nX (
    xcopy %%X %_DEST% /defy >>"%run_log%"
    call sd.exe add %%X >>"%run_log%"
)

Check out for /? for explanation and other goodies.

system PAUSE