Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Error Handling in WinSCP

You can test existence of file/directory using stat command.
https://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.
John Garland

Error Handling in WinSCP

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.