Hi,
I am also having similar problem while closing the session. I am just getting one file from remote directory using below script. File was copied, but it had problems while closing the session.
I checked the Exit Code of the script in batch file. It was 1.
Here is my Script:
\\\\
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch abort
option echo off
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open sftp://%USERNAME%:%PASSWORD%@%HOST%:22
# Change remote directory
cd %SOURCE_DIR%
# Force binary mode transfer
option transfer binary
# check flag file
get xxx.flg
# Disconnect
close
# Exit WinSCP
exit
\\\\\
This script was running fine, but today following problem occurred.
Log file:
batch abort
echo off
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "s3m_system".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user@xxx.xxx.xxx.xx
/bdata/exp/check_img
transfer binary
xxx.flg | 0 KiB | 0.0 KiB/s | binary | 0%
Host has not answered for more than 15 seconds. Still waiting...
Warning: Aborting this operation will close connection!
(A)bort: Abort
Terminated by user.
(A)bort, (R)econnect (5 s): Reconnect
Searching for host...
Connecting to host...
Authenticating...
Host has not answered for more than 15 seconds. Still waiting...
Warning: Aborting this operation will close connection!
(A)bort: Abort
Terminated by user.
Authentication failed.
(A)bort, (R)econnect (5 s): Reconnect
Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
check status code "1"
/////
As per my understanding, file gets copied, but while closing the session, connection to host was lost. It has tried few times, and got successfully connected, but returned the exit code as 1, while command 'close'.
I also checked that, my WINSCP.INI file updated everytime after closing the session, but when this error occurred, INI file was not updated.
How can I avoid this from happening in future ?
Thanks in Advance,
Kedar