winSCP returned with File does not exist: error code 2

Advertisement

kmolnar@its.jnj.com
Joined:
Posts:
1

winSCP returned with File does not exist: error code 2

I have been running WinSCP in scripting mode from a Windows batch file on a Windows 2003 server. I got into a situation where the Put operation complained about not finding the file to transfer, but I still did not get any Windows level error code back.
****************************************************
ftp log file:
*****************************************************
batch on
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "user1".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] user1@jnj.com
/opt/cyc/common/data/out/EES/JNJ/CDRH_AERS
D:\eMDR\Outbound\EES\JNJ-ZZFDATST-CDRH-AERS-3500A-1012200915243-1-3OIT7E.xml | 0 KiB | 0.0 KiB/s | binary | 0%
File or folder 'D:\eMDR\Out\EES\JNJ-ZZFDATST-CDRH-AERS-3500A-1012200915243-1-3OIT7E.xml' does not exist.
System Error. Code: 2.

The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
*****************************************************************
As you see, the log file had an error code, but it did not get propagated onto the Windows batch file level.
The same script was properly running (returning no error code with successful run, returning error code with failed run) on the same server like about 60 times previously.
I would appreciate if you could reply ASAP.

Thanks,

Kati

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: winSCP returned with File does not exist: error code 2

So are you able to reproduce the problem with error code? If you are I can send you a debug version. Btw, how do you check for error code?

Reply with quote

Kati
Guest

winSCP returned with File does not exist

In the batch file executing the WinSCP script, there is the following line:

IF %ErrorLevel% GTR 0 (
SET Errmsg="Failed to FTP File"
GOTO ERROR
)

On further investigation, I have realized that some Windows level errors (e.g. probably file does not exist) are returned with negative code. The Windows script fragment above does not catch negative error codes.

In order to catch negative error codes, I changed the above test to
IF %ErrorLevel% NEQ 0 (
SET Errmsg="Failed to FTP File"
GOTO ERROR
)

Kati

Reply with quote

martin
Site Admin
martin avatar

Re: winSCP returned with File does not exist

Looks OK.
WinSCP returns only 0 (on success) or 1 (on error).
Can you post your script and command you use to run WinSCP.

Reply with quote

Advertisement

You can post new topics in this forum