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.

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: errorlevels ... again

Prime wrote:

Just to clarify, when I run the script, I should get an errorlevel 1 for ANY failure during the process?

Yes.
martin

Re: errorlevels ... again

The relevant section of the script is

:RetryLoop
winscp3.exe /console /script=transfer.txt || goto RetryLoop

Transfer.txt is
option batch on
option confirm off
option transfer binary
open (server location)
synchronize remote
close
exit

Unfortunately for this exact script it works for me. Attempts to connect repeat indefinitely. I'll do more tests.
Prime

Re: errorlevels ... again

martin wrote:

Please post your script file. For me error code 1 is returned, when there is a timeout. Also are you sure you are using the latest version of WinSCP?


Ok, here it is ...
<-----download script start----->
# Automatically answer all prompts negatively so as not to stall the script on errors
option batch on


# Disable overwrite confirmations that conflict with previous
option confirm off


# Open session to Storm
open username:password@remote.server.com
option transfer binary

#
# Retrieve remote files and put them in our local directory
#


# Get files from Ron & Andy's remote directory and put in Ron's local directory
lcd "y:\!Downloads_From_Storm\Ron"
cd "/Storm HQ to Redcliffe/Ron"
get *.* .\


# Get files from Bob's remote directory and put in Bob's local directory
lcd "y:\!Downloads_From_Storm\Bob"
cd "/Storm HQ to Redcliffe/Bob"
get *.* .\


# Get files from Terry's remote directory and put in Terry's local directory
lcd "y:\!Downloads_From_Storm\Terry"
cd "/Storm HQ to Redcliffe/Terry"
get *.* .\


# Close Transfer Session
close


# Exit the application (WinScp)
exit

<------download script end------>

There isn't anything special here as far as I can tell ... I've just checked, the version I'm running is 3.75 ... I haven't updated to 3.76 yet because the release notes didn't mention any major bug fixes in the area of scripting.

Just to clarify, when I run the script, I should get an errorlevel 1 for ANY failure during the process?

Cheers.

Prime.
Guest

Re: errorlevels ... again

martin wrote:

Please post your script file. For me error code 1 is returned, when there is a timeout. Also are you sure you are using the latest version of WinSCP?


I am using 3.7.6 which the web site reports as the latest.

The relevant section of the script is

:RetryLoop
winscp3.exe /console /script=transfer.txt || goto RetryLoop

Transfer.txt is
option batch on
option confirm off
option transfer binary
open (server location)
synchronize remote
close
exit
martin

Re: errorlevels ... again

Please post your script file. For me error code 1 is returned, when there is a timeout. Also are you sure you are using the latest version of WinSCP?
Guest

Re: errorlevels ... again

I am having this same problem too and find that the timeouts are quite frequent. It should a.) return an error code and b.) there should be some sort of auto-reconnect/auto-retry option.
Prime

errorlevels ... again

Ok, I thought I had the problem sorted out but there is still an issue.

As per the activity log snippet below, if the remote server times outs, the "abort" is automatically sent ...

The log would indicate that the errorlevel returned is 0 which means it was a success. Clearly this is not the case ... any thoughts?

<-----snippet starts----->
Uploading files started ... <== this comment added by my batch file
batch on
confirm off
Initialisation...
Searching for host...
Connecting to host...
Authenticating...
Host has not answered for 15 seconds.
Wait for another 15 seconds? Pressing 'Abort' button will close session.
(A)bort, (R)etry: Abort
Authentication failed.
Terminated by user.
transfer binary
y:\!Uploads_To_Storm
No session.
No session.
No session.
File(s) successfully uploaded ... <== this comment added by my batch file
<-----snippet ends----->