Topic "Error Handling in WinSCP"

Author Message
John Garland
[View user's profile]

Joined: 2013-01-29
Posts: 3
Location: North East England
Hi, I'm attempting to write a generic parameterised Windows batch script to perform sftp tasks by calling WINSCP. Is there a way to validate a remote directory name before it is used as it seems I can do a "get -delete" successfully, and then if I run "get -delete" again, no error message is returned, despite there being no files to get. I just want to be certain that when I display a "success" message the sftp has worked, and when I display a "fail" message the sftp has failed.
"cd <invalidremotepath>" does not seem to generate an error until an attempt is made to write to the invalid folder.

Thanks.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
You can test existence of file/directory using stat command.
http://winscp.net/eng/docs/scriptcommand_stat

Also, if you turn off directory caching (or start the script with empty cache), even the cd should fail straight away.
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