Topic "Scripting options..."

Author Message
DN

Guest


Hi,

It seems that no matter what set of options I use in my script, if I disconnect during a file transfer, the program will try to reconnect to the server over and over again. I want it to simply exit with an errorlevel without trying to reconnect! I HAVE tried setting the reconnecttime to off:

option reconnecttime off

but this doesn't change the outcome! I've tried it with option batch on/off/abort/continue. Still tries to reconnect. I've tried it with confirm off/on. Still tries to reconnect.

I'm using v4.2.8.

Basically put, I have a small script that I want to run in an automated way without any user intervention under any circumstance. If the server disconnects or if the file download fails, I don't mind, I want the script to simply continue but return an errorlevel of 1...
Advertisements
DN

Guest


Hi again,

No answers? Sigh... HELP ME PLEASE!

This is my script (sensitive information has been marked out with x's):

option batch on
option confirm off
option reconnecttime off
option transfer binary
open ftp://xxxxxxxx:xxxxxxxx@xxxxx.xxxxx.xxx
put c:\xxx.xxx /xxx/xxxxxxx/xxxxxxxxxx/xx/xxxxx/xxxx/xx/xxx.xxx
exit

---

These are the on-screen results (sensitive information has been marked out with x's):

batch on
confirm off
reconnecttime off
transfer binary
Connecting to xxxxx.xxxxx.xxx ...
Connected with xxxxx.xxxxx.xxx. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxxx@xxxxx.xxxxx.xxx
c:\xxx.xxx | 97232 KiB | 0.0 KiB/s | binary | 34%
Lost connection.
Timeout detected.
Copying files to remote side failed.
Opening data connection for xxx.xxx.
(A)bort, (R)econnect (0 s): Reconnect
Connecting to xxxxx.xxxxx.xxx ...
Connection failed.
The requested name is valid, but no data of the requested type was found.
Connection failed.
(A)bort, (R)econnect (4 s): Abort
Lost connection.
Timeout detected.
Copying files to remote side failed.
Opening data connection for xxx.xxx.
Copying files to remote side failed.
Session 'xxxxxxxx@xxxxx.xxxxx.xxx' closed.
No session.

C:\WinSCP>


I manually disconnected from the internet when the file reached 34% for testing purposes. I wanted the script to "abort" the upload (put) and simply exit back to DOS with an errorlevel of 1. I also want the file to be overwritten if it already exists and without questioning me. Of course, if I put a -append in the put statement then I would obviously want it to append (but that's another story for now).

Note that I had to manually press A to Abort the script. The thing is, I don't want it to try to reconnect, but that is what it was doing above. I thought my options would give me what I want, but it does not. Please help! Smile
DN

Guest


Hi again,

No answers? Sigh... HELP ME PLEASE!

This is my script (sensitive information has been marked out with x's):

option batch on
option confirm off
option reconnecttime off
option transfer binary
open ftp://xxxxxxxx:xxxxxxxx@xxxxx.xxxxx.xxx
put c:\xxx.xxx /xxx/xxxxxxx/xxxxxxxxxx/xx/xxxxx/xxxx/xx/xxx.xxx
exit

---

These are the on-screen results (sensitive information has been marked out with x's):

batch on
confirm off
reconnecttime off
transfer binary
Connecting to xxxxx.xxxxx.xxx ...
Connected with xxxxx.xxxxx.xxx. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxxx@xxxxx.xxxxx.xxx
c:\xxx.xxx | 97232 KiB | 0.0 KiB/s | binary | 34%
Lost connection.
Timeout detected.
Copying files to remote side failed.
Opening data connection for xxx.xxx.
(A)bort, (R)econnect (0 s): Reconnect
Connecting to xxxxx.xxxxx.xxx ...
Connection failed.
The requested name is valid, but no data of the requested type was found.
Connection failed.
(A)bort, (R)econnect (4 s): Abort
Lost connection.
Timeout detected.
Copying files to remote side failed.
Opening data connection for xxx.xxx.
Copying files to remote side failed.
Session 'xxxxxxxx@xxxxx.xxxxx.xxx' closed.
No session.

C:\WinSCP>


I manually disconnected from the internet when the file reached 34% for testing purposes. I wanted the script to "abort" the upload (put) and simply exit back to DOS with an errorlevel of 1. I also want the file to be overwritten if it already exists and without questioning me. Of course, if I put a -append in the put statement then I would obviously want it to append (but that's another story for now).

Note that I had to manually press A to Abort the script. The thing is, I don't want it to try to reconnect, but that is what it was doing above. I thought my options would give me what I want, but it does not. Please help! Smile
Guest




Sorry about the double-post... Embarassed
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
You can disable the automatic reconnect in GUI preferences.
_________________
Martin Prikryl
DN

Guest


prikryl wrote:
You can disable the automatic reconnect in GUI preferences.


Hi Martin,

Thank you for your reply.

My issue with your answer is that having to do it in the GUI, rely on the fact that it has been done after an install and that it stays that way so that my script functions as I expect (it's batch mode) worries me especially given the fact that I want "remote people" to use my script. I'm sure you can understand my issue. Right now, it's the ONLY issue stopping me from using WinSCP. Please tell me that you will incorporate that same feature as a script option command? In fact, I thought it was ALREADY implemented with the option "reconnecttime" where setting it to "off" would have made it work that way (i.e. not try to reconnect) -- setting it to 0 would mean that it would try to re-connect without any delay...

Please advise ASAP! Very Happy
Guest




prikryl wrote:
You can disable the automatic reconnect in GUI preferences.


Hi Martin,

I really didn't look at the GUI much since my main goal was to have a script that automated everything including all the options that I would need to set to ensure that it would function EXACTLY as I expected no matter who was running the script and what their settings were in the GUI. After having looked at the GUI now, I just realized that there is an export command which will write out an INI file. I've also realize that I can start WinSCP with my script while providing the name of an INI file using the "ini=" command line parameter. I'm guessing if I set the disconnect GUI preferences the way I want (including any other preferences), export the INI file, use it on the WinSCP command line when I fire off my script then I WILL have it working the way I want and I will be sure it'll be the way that I expect. I suppose this would be your follow-up answer to me? Shocked I'll give it a whirl and see what happens. Thanks.

P.S. It would STILL be nice to have it under script option control... Laughing
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Your assumptions are correct.
_________________
Martin Prikryl
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