Topic "Script Retrying success statements as well instead of only failed"

Author Message
Sekhar

Guest


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.

Code:
@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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
That's not possible with a simple scripting.

You can use PowerShell script with use of WinSCP .NET assembly.
See https://winscp.net/eng/docs/library_example_recursive_download_custom_error_handling
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License