Topic "Error handling"

Author Message
[View user's profile]

Joined: 2013-12-04
Posts: 1
Location: UK
I use the following simple script to connect to a remote site, copy any files there to a local site and then delete the remote files.

open sftp://user:password@ip address
cd /sage
get *.* c:\FTP\incoming\
rm *.*

Is there any error checking I can introduce to prevent the remote files being deleted if the transfer is unsuccessful, or will the rm command not execute and time out if the previous get line does not complete?

Any assistance would be greatly appreciated.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26890
Location: Prague, Czechia
You need to use option batch abort at the start of the script.

Even better, use -delete switch with the get command, instead of rm command.

You can post new topics in this forum


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