charlespliler
asked on
Batch file version of "on error resume nest"
I have a batch file to copy logs from single servers to a shared loaction. It seems that if any of the files in the source directory are locked or in use the whole batch file command set fails and issues and exit code of 4. Is ther a line to add to tell the commands if there is an error with any of the files to copy to just move on to the next. Batch file is as follows.
@echo off
set T=%time:~0,5%
set dir=%date:/=-% %T::=-%
echo The target folder is "%dir%".
mkdir "\\usmoksc5app55\text\usmo ksc5app27\ %dir%"
xcopy /L "D:\GCTI\Logs\*.*" > "\\usmoksc5app55\text\usmo ksc5app27\ %dir%\%dat e:/=-% %T::=%.log"
xcopy /s /c /y "D:\GCTI\Logs\ksc_sip_pri\ Archive\*. *" "\\usmoksc5app55\logs\usmo ksc5app27\ %dir%\"
@echo off
set T=%time:~0,5%
set dir=%date:/=-% %T::=-%
echo The target folder is "%dir%".
mkdir "\\usmoksc5app55\text\usmo
xcopy /L "D:\GCTI\Logs\*.*" > "\\usmoksc5app55\text\usmo
xcopy /s /c /y "D:\GCTI\Logs\ksc_sip_pri\
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I also use robocopy amd set it for 1 retry in 1 second. This basically just skips files that don't exist.
on error goto
Here's a sample - http://newton.freehostia.com/net/batch/batguide.html