I'm running TCMD/TCC 12.11 x64 and have the following batch fragment:
The variables are all set prior in the batch file. I just specifically defined them here for testing. The issue I'm having is that if %DEST (C:\DAUDIO\1\1GE14\05130903.28\0016) already exists, it completely skips the "echo Restoring" and robocopy lines and just displays "Done." If %DEST doesn't exist, it creates it and copies correctly.
I don't have anything in there telling it to skip if it already exists so I'm confused. If I tell it to delete %DEST then it copies correctly every time. Also, if I remove the "if not isdir %DEST md /s /n %DEST" line then it echos the "Restoring" line but still doesn't run the robocopy.
Any ideas on this would be helpful. The goal is it should run robocopy every time regardless of whether or not the destination folder already exists.
Code:
@echo off
setlocal
set RESTOREDATE=1GE140513
set CASECODE=16
set CC=\0016
set CTRM=1GE
set YY=14
set MM=05
set DD=13
set NODE=1
set DAUDIO="G:\DAUDIO\1\1GE14\0513*"
set OFFSET=-12
iff %@len[%@EXPAND[%DAUDIO]] EQ 0 then
echo.
echo ` `No hearings found for 20%YY/%MM/%DD in courtroom %CTRM
echo.
else
iff "%PROG" EQ "CourtABLE" then
set OFFSET=-24
else
set OFFSET=-12
endiff
for %SRC in (%@EXPAND[%DAUDIO]) do (
echo.
iff isdir %SRC%%CC then
set DEST=C:\DAUDIO\%NODE\%@RIGHT[%OFFSET,%SRC]%CC
if not isdir %DEST md /s /n %DEST
echo ` `Restoring %@RIGHT[%OFFSET,%SRC]%CC, please wait...
start /wait robocopy %SRC%%CC %DEST /e /z /is /it /r:0 /w:0 /copy:DAT
else
echo ` `Case code %@RIGHT[-1,%CC] not found for %@RIGHT[%OFFSET,%SRC] in courtroom %CTRM
endiff
)
echo done.
echo.
endiff
endlocal
I don't have anything in there telling it to skip if it already exists so I'm confused. If I tell it to delete %DEST then it copies correctly every time. Also, if I remove the "if not isdir %DEST md /s /n %DEST" line then it echos the "Restoring" line but still doesn't run the robocopy.
Any ideas on this would be helpful. The goal is it should run robocopy every time regardless of whether or not the destination folder already exists.