Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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)


Topic review


Re: Error trapping during Automated Script

WinSCP returns exit code 1 on any error. Please refer to the documentation.

Error trapping during Automated Script

I need to automate SFTP using Winscp. I have created a script file that turns BATCH on and CONFIRM off and the file is uploaded. Problem is, this will be an unattended process. I need a way of determining if there were any errors and then report it to proper personnel. How do I determine if there were any errors.

Here is my script:
# Automatically answer all prompts negativelly not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with previous
option confirm off
# Force binary mode transfer
option transfer binary
# Upload file to current working directory
put c:\data\temp\test.txt
# Disconnect
# Exit WinSCP

I am calling Winscp from within Visual FoxPro with its run command.