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.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24759
Location: Prague, Czechia
You can test existence of file/directory using stat command.

Also, if you turn off directory caching (or start the script with empty cache), even the cd should fail straight away.

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