Topic "Script succeeding when a file fails to download"

Author Message


I have a script that runs every 10 minutes. It downloads some files using command

get -delete xyz*

There are normally one to 3 files fitting that pattern.

Today, we had a situation where there were two files on the FTP site that fit that pattern and the first downloaded properly but the second failed to download. I have the log file from this situation, but it's not really what I need help on. The batch file failed with an error per

if %ERRORLEVEL% neq 0 goto error
exit 0
exit 1

When it ran again 10 minutes later, there were three files that matched the pattern. The first successfully downloaded, the second failed to download, and the third successfully downloaded. The batch file did not fail. I didn't save the log file from this instance. The log files are emailed to me when the batch fails, but of course since the batch didn't fail nothing was emailed to me. I let it get overwritten after I looked at it.

Is there something I can do to make the batch job fail if any file fails to download?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24755
Location: Prague, Czechia
The script will fail, if any file fails to download.

I cannot help you further without the log file.

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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License