Topic "Error handling"

Author Message
litestream
[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 *.*
exit

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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
You need to use option batch abort at the start of the script.
http://winscp.net/eng/docs/scriptcommand_option

Even better, use -delete switch with the get command, instead of rm command.
http://winscp.net/eng/docs/scriptcommand_get
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