Batch file with skip command option in case of error

Add “call” in the beginning of command robocopy, in case robocopy gives access denied error.

cls
@echo off

set CD=%PWD%

call robocopy “\Lsfs01\files\GROUP\LFCU\DMSUploads\TrxDocs\newdocs\Nancy Durazo” “\lfcunas01\AccountProcess\TrxDocs\newdocs\Nancy Durazo” *.pdf /MOV /E
echo First robocopy completed with errorlevel %ERRORLEVEL%

call robocopy “\Lsfs01\files\GROUP\LFCU\DMSUploads\TrxDocs\newdocs\Loretta Aguilar” “\lfcunas01\AccountProcess\TrxDocs\newdocs\Loretta Aguilar” *.pdf /MOV /E
echo First robocopy completed with errorlevel %ERRORLEVEL%

call robocopy “\Lsfs01\files\GROUP\LFCU\DMSUploads\TrxDocs\newdocs” “\lfcunas01\AccountProcess\TrxDocs\newdocs” *.pdf /MOV /E
echo First robocopy completed with errorlevel %ERRORLEVEL%

set CLASSPATH1=D:\Custom\classess;D:\Documentum\product\dctm-server.jar;D:\Documentum\config;”D:\Program Files”\Documentum\dctm.jar;D:\custom\lib\jai_codec.jar;d:\custom\lib\jai_core.jar;d:\custom\lib\jai_imageio.jar;D:\cms\NoImageReport;D:\Custom\lib\cms-baseservice.jar;D:\Custom\lib\cms-exceptionhandler.jar;D:\Custom\lib\commons-io-2.4.jar;D:\Custom\lib\log4j-1.2.14.jar;D:\Custom\lib\slf4j-api-1.7.2.jar;D:\Custom\lib\slf4j-log4j12-1.7.2.jar;D:\Custom\lib\cms-javautils.jar;D:\Custom\lib\mail.jar;D:\Custom\classes;D:\Custom\lib\cms-accntindexerfactory.jar;D:\Custom\lib\cms-autoindexer.jar;D:\Custom\lib\cms-runlogfactory.jar;D:\Custom\lib\cms_branchdata_custom.jar;D:\Custom\lib\sqljdbc.jar;D:\Custom\lib\jtds-1.3.1.jar;D:\Custom\classess\mail.xml;D:\Custom\lib\CMSmail.jar;D:\Custom\lib\itextpdf-5.2.1.jar;D:\Custom\lib\bcprov-jdk15on-150.jar

setLocal EnableDelayedExpansion
set CLASSPATH2=
for /R D:\Custom\lib %%a in (*.jar) do (
set CLASSPATH2=!CLASSPATH2!;%%a
)
set CLASSPATH2=!CLASSPATH2!

SETLOCAL
set timestamp=%DATE:/=-%
set timestamp=%timestamp: =%
set LOGFILE=%timestamp%

D:\java\jdk1.8.0_181\bin\java -Xmx2048M -Xss2048K -cp %CLASSPATH1%;%CLASSPATH2%;%JARPATH%;log4j.properties;D:\Documentum\config\dfc.properties TransactionDocImportFromFolder -props D:\Custom\classess\trx_alligator.xml >> D:\Custom\logs\trx\trx_alligator_%LOGFILE%.log 2>&1

robocopy “\lfcunas01\AccountProcess\TrxDocs\error” “\Lsfs01\files\GROUP\LFCU\DMSUploads\TrxDocs\error” *.pdf /MOV /E

Leave a Reply

Your email address will not be published. Required fields are marked *