Script Retrying success statements as well instead of only failed

Advertisement

Sekhar
Guest

Script Retrying success statements as well instead of only failed

Hello Team,

I have list of files to be downloaded/transfer from a remote server to my local server. When one of the file got failed then script is retrying all the files again. But i need to retry only failed file. Please help with a solution.

I am using below scritp.

@echo off
set TRIES=0
set INTERVAL=10
 
:retry
 
winscp.exe /console ^
      /script=E:\AutoMIS\Airtel_Daily\log.tmp ^
      /log=E:\AutoMIS\Airtel_Daily\logs\%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%.log


if %ERRORLEVEL% neq 0 (
   set /A TRIES=%TRIES%-1
   if %TRIES% gtr 1 (
       echo Failed, retrying in %INTERVAL% seconds...
       timeout /t %INTERVAL%
       goto retry
   ) else (
       echo Error!
       sendmail.exe -t < error_mail.txt
       exit /b 1
   )
)

 
echo Success
sendmail.exe -t < success_mail.txt
exit /b 0

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum