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

retlacs

Martin,
I am hoping you can help me please.
It ran again today and the file was transferred successfully but it gave a return code 1 because of the status code = 2 on the log. Because the FTP script is giving a bad return code, the entire job is failing even though the file had been transferred. We are using WinSCP v 5.21.8 Build 13000 2023-04-11. I also tried to manually transferred file using the WinSCP GUI and no error.

Here is the log today and the error is at:
 < 2023-05-17 11:44:35.658 Status code: 2

. 2023-05-17 11:44:35.296 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.297 WinSCP Version 5.21.8 (Build 13000 2023-04-11) (OS 10.0.19045 - Windows 10 Enterprise)
. 2023-05-17 11:44:35.297 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2023-05-17 11:44:35.297 Log level: Normal, Rotating after: 1G, Keeping at most 10 logs
. 2023-05-17 11:44:35.297 Local account: FRONTIER\jl
. 2023-05-17 11:44:35.297 Working directory: C:\Program Files (x86)\WinSCP
. 2023-05-17 11:44:35.297 Process ID: 716
. 2023-05-17 11:44:35.314 Ancestor processes: cmd, Code, Code, Code, explorer, ...
. 2023-05-17 11:44:35.315 Command-line: winscp.exe  /hostkey=ssh-rsa 2048 fgsgfdgfdhgfghgjghj /log=C:\Automate\Logs\D022_FTP_To_GlassLewis_2023_05_17.log /loglevel=0 /command "option batch abort" "option confirm off" "open sftp://FRO098:***@ftp.glasslewis.com/ -rawsettings FSProtocol=2" "put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv" close "exit"
. 2023-05-17 11:44:35.315 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/12/2023, DST End: 11/5/2023
. 2023-05-17 11:44:35.316 Login time: Wednesday, May 17, 2023 11:44:35 AM
. 2023-05-17 11:44:35.316 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.316 Script: Retrospectively logging previous script records:
< 2023-05-17 11:44:35.316 Script: Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
. 2023-05-17 11:44:35.316 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.316 Session name: 2048 (Ad-Hoc site)
. 2023-05-17 11:44:35.316 Host name: 2048 (Port: 22)
. 2023-05-17 11:44:35.316 User name:  (Password: No, Key file: No, Passphrase: No)
. 2023-05-17 11:44:35.316 Tunnel: No
. 2023-05-17 11:44:35.316 Transfer Protocol: SFTP (SCP)
. 2023-05-17 11:44:35.316 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2023-05-17 11:44:35.316 Disable Nagle: No
. 2023-05-17 11:44:35.316 Proxy: None
. 2023-05-17 11:44:35.316 Send buffer: 262144
. 2023-05-17 11:44:35.316 Compression: No
. 2023-05-17 11:44:35.316 Bypass authentication: No
. 2023-05-17 11:44:35.316 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2023-05-17 11:44:35.316 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2023-05-17 11:44:35.316 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2023-05-17 11:44:35.316 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2023-05-17 11:44:35.316 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2023-05-17 11:44:35.316 Simple channel: Yes
. 2023-05-17 11:44:35.316 Return code variable: Autodetect; Lookup user groups: Auto
. 2023-05-17 11:44:35.316 Shell: default
. 2023-05-17 11:44:35.316 EOL: LF, UTF: Auto
. 2023-05-17 11:44:35.316 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2023-05-17 11:44:35.316 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2023-05-17 11:44:35.316 SFTP Bugs: Auto,Auto
. 2023-05-17 11:44:35.316 SFTP Server: default
. 2023-05-17 11:44:35.316 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2023-05-17 11:44:35.316 Cache directory changes: Yes, Permanent: Yes
. 2023-05-17 11:44:35.316 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2023-05-17 11:44:35.316 DST mode: Unix
. 2023-05-17 11:44:35.316 --------------------------------------------------------------------------
< 2023-05-17 11:44:35.316 Script: Searching for host...
. 2023-05-17 11:44:35.317 Looking up host "2048" for SSH connection
. 2023-05-17 11:44:35.317 Connecting to 0.0.8.0 port 22
. 2023-05-17 11:44:35.320 Failed to connect to 0.0.8.0: Network error: Network is unreachable
< 2023-05-17 11:44:35.320 Script: Network error: Network is unreachable
. 2023-05-17 11:44:35.322 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.322 WinSCP Version 5.21.8 (Build 13000 2023-04-11) (OS 10.0.19045 - Windows 10 Enterprise)
. 2023-05-17 11:44:35.322 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2023-05-17 11:44:35.322 Log level: Normal, Rotating after: 1G, Keeping at most 10 logs
. 2023-05-17 11:44:35.322 Local account: XYZ\jl
. 2023-05-17 11:44:35.322 Working directory: C:\Program Files (x86)\WinSCP
. 2023-05-17 11:44:35.322 Process ID: 716
. 2023-05-17 11:44:35.322 Ancestor processes: cmd, Code, Code, Code, explorer, ...
. 2023-05-17 11:44:35.323 Command-line: winscp.exe  /hostkey=ssh-rsa 2048 sflasjfkajfalksdjldf /log=C:\Automate\Logs\D022_FTP_To_GlassLewis_2023_05_17.log /loglevel=0 /command "option batch abort" "option confirm off" "open sftp://FRO098:***@ftp.glasslewis.com/ -rawsettings FSProtocol=2" "put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv" close "exit"
. 2023-05-17 11:44:35.323 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/12/2023, DST End: 11/5/2023
. 2023-05-17 11:44:35.323 Login time: Wednesday, May 17, 2023 11:44:35 AM
. 2023-05-17 11:44:35.323 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.323 Script: Retrospectively logging previous script records:
. 2023-05-17 11:44:35.324 Script: Failed
> 2023-05-17 11:44:35.324 Script: option batch abort
< 2023-05-17 11:44:35.324 Script: batch           abort     
> 2023-05-17 11:44:35.324 Script: option confirm off
< 2023-05-17 11:44:35.324 Script: confirm         off       
> 2023-05-17 11:44:35.324 Script: open sftp://uid:***@ftp.glasslewis.com/ -rawsettings FSProtocol=2
. 2023-05-17 11:44:35.324 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.324 Session name: uid@ftp.glasslewis.com (Ad-Hoc site)
. 2023-05-17 11:44:35.324 Host name: ftp.glasslewis.com (Port: 22)
. 2023-05-17 11:44:35.324 User name: uid (Password: Yes, Key file: No, Passphrase: No)
. 2023-05-17 11:44:35.324 Tunnel: No
. 2023-05-17 11:44:35.324 Transfer Protocol: SFTP
. 2023-05-17 11:44:35.324 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2023-05-17 11:44:35.324 Disable Nagle: No
. 2023-05-17 11:44:35.324 Proxy: None
. 2023-05-17 11:44:35.324 Send buffer: 262144
. 2023-05-17 11:44:35.324 Compression: No
. 2023-05-17 11:44:35.324 Bypass authentication: No
. 2023-05-17 11:44:35.324 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2023-05-17 11:44:35.324 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2023-05-17 11:44:35.324 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2023-05-17 11:44:35.324 KEX: ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2023-05-17 11:44:35.324 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2023-05-17 11:44:35.324 Simple channel: Yes
. 2023-05-17 11:44:35.324 Return code variable: Autodetect; Lookup user groups: Auto
. 2023-05-17 11:44:35.324 Shell: default
. 2023-05-17 11:44:35.324 EOL: LF, UTF: Auto
. 2023-05-17 11:44:35.324 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2023-05-17 11:44:35.324 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2023-05-17 11:44:35.324 SFTP Bugs: Auto,Auto
. 2023-05-17 11:44:35.324 SFTP Server: default
. 2023-05-17 11:44:35.324 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2023-05-17 11:44:35.324 Cache directory changes: Yes, Permanent: Yes
. 2023-05-17 11:44:35.324 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2023-05-17 11:44:35.324 DST mode: Unix
. 2023-05-17 11:44:35.324 --------------------------------------------------------------------------
< 2023-05-17 11:44:35.324 Script: Searching for host...
. 2023-05-17 11:44:35.325 Looking up host "ftp.glasslewis.com" for SSH connection
. 2023-05-17 11:44:35.332 Connecting to 40.67.156.136 port 22
. 2023-05-17 11:44:35.349 Connected to 40.67.156.136
< 2023-05-17 11:44:35.349 Script: Connecting to host...
. 2023-05-17 11:44:35.349 We claim version: SSH-2.0-WinSCP_release_5.21.8
. 2023-05-17 11:44:35.349 Connected to 40.67.156.136
. 2023-05-17 11:44:35.365 Remote version: SSH-2.0-CerberusFTPServer_11.0 FIPS
. 2023-05-17 11:44:35.366 Using SSH protocol version 2
. 2023-05-17 11:44:35.367 Have a known host key of type rsa2
. 2023-05-17 11:44:35.384 Doing ECDH key exchange with curve nistp256 and hash SHA-256
. 2023-05-17 11:44:35.461 Host key fingerprint is:
. 2023-05-17 11:44:35.461 ssh-rsa 2048 SHA256:sfsadfsa,d;fa;lfkasl;fk
< 2023-05-17 11:44:35.461 Script: Authenticating...
. 2023-05-17 11:44:35.462 Host key matches cached key
. 2023-05-17 11:44:35.462 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2023-05-17 11:44:35.462 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2023-05-17 11:44:35.477 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2023-05-17 11:44:35.478 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2023-05-17 11:44:35.494 Using username "uid".
< 2023-05-17 11:44:35.494 Script: Using username "uid".
. 2023-05-17 11:44:35.511 Server offered these authentication methods: password,publickey
. 2023-05-17 11:44:35.511 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2023-05-17 11:44:35.511 Using stored password.
< 2023-05-17 11:44:35.511 Script: Authenticating with pre-entered password.
. 2023-05-17 11:44:35.511 Sent password
. 2023-05-17 11:44:35.570 Access granted
. 2023-05-17 11:44:35.571 Opening main session channel
. 2023-05-17 11:44:35.586 Opened main channel
. 2023-05-17 11:44:35.602 Started a shell/command
< 2023-05-17 11:44:35.602 Script: Authenticated.
. 2023-05-17 11:44:35.602 --------------------------------------------------------------------------
. 2023-05-17 11:44:35.602 Using SFTP protocol.
. 2023-05-17 11:44:35.603 Doing startup conversation with host.
< 2023-05-17 11:44:35.603 Script: Starting the session...
> 2023-05-17 11:44:35.603 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2023-05-17 11:44:35.619 Type: SSH_FXP_VERSION, Size: 176, Number: -1
. 2023-05-17 11:44:35.619 SFTP version 6 negotiated.
. 2023-05-17 11:44:35.619 Server requests EOL sequence "\r\n".
. 2023-05-17 11:44:35.619 Server software: Cerberus FTP Server 11.1.0.0 (110100000) by Cerberus, LLC
. 2023-05-17 11:44:35.619 Server support information (supported2):
. 2023-05-17 11:44:35.619   Attribute mask: 2BD, Attribute bits: FF, Open flags: 7
. 2023-05-17 11:44:35.619   Access mask: 3, Open block vector: 0, Block vector: 0, Max read size: 0
. 2023-05-17 11:44:35.620   Attribute extensions (0)
. 2023-05-17 11:44:35.620   Extensions (2)
. 2023-05-17 11:44:35.620     check-file
. 2023-05-17 11:44:35.620     copy-file
. 2023-05-17 11:44:35.620 We will use UTF-8 strings as it is mandatory with SFTP version 4 and newer
. 2023-05-17 11:44:35.620 Getting current directory name.
. 2023-05-17 11:44:35.620 Getting real path for '.'
> 2023-05-17 11:44:35.620 Type: SSH_FXP_REALPATH, Size: 11, Number: 16
< 2023-05-17 11:44:35.638 Type: SSH_FXP_NAME, Size: 72, Number: 16
. 2023-05-17 11:44:35.638 Real path is '/'
. 2023-05-17 11:44:35.638 Startup conversation with host finished.
< 2023-05-17 11:44:35.638 Script: Session started.
< 2023-05-17 11:44:35.638 Script: Active session: [1] uid@ftp.glasslewis.com
> 2023-05-17 11:44:35.638 Script: put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv
. 2023-05-17 11:44:35.640 Copying 1 files/directories to remote directory "/" - total size: 239,841
. 2023-05-17 11:44:35.640   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2023-05-17 11:44:35.640   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2023-05-17 11:44:35.640   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2023-05-17 11:44:35.640 File: '\\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230516.csv' [2023-05-17T07:37:57.063Z] [239841]
. 2023-05-17 11:44:35.641 Copying "\\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230516.csv" to remote directory started.
. 2023-05-17 11:44:35.641 Binary transfer mode selected.
. 2023-05-17 11:44:35.641 Checking existence of file.
> 2023-05-17 11:44:35.641 Type: SSH_FXP_LSTAT, Size: 33, Number: 263
< 2023-05-17 11:44:35.658 Type: SSH_FXP_STATUS, Size: 55, Number: 263
< 2023-05-17 11:44:35.658 Status code: 2
. 2023-05-17 11:44:35.658 Checking existence of partially transferred file.
> 2023-05-17 11:44:35.658 Type: SSH_FXP_LSTAT, Size: 42, Number: 519
< 2023-05-17 11:44:35.675 Type: SSH_FXP_STATUS, Size: 55, Number: 519
< 2023-05-17 11:44:35.675 Status code: 2
. 2023-05-17 11:44:35.675 Opening remote file.
> 2023-05-17 11:44:35.675 Type: SSH_FXP_OPEN, Size: 51, Number: 771
< 2023-05-17 11:44:35.693 Type: SSH_FXP_HANDLE, Size: 47, Number: 771
> 2023-05-17 11:44:35.693 Type: SSH_FXP_WRITE, Size: 16379, Number: 1286
. 2023-05-17 11:44:35.722 14 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2023-05-17 11:44:35.722 Type: SSH_FXP_CLOSE, Size: 47, Number: 5124
< 2023-05-17 11:44:35.752 Type: SSH_FXP_STATUS, Size: 22, Number: 1286
< 2023-05-17 11:44:35.752 Status code: 0
< 2023-05-17 11:44:35.765 Type: SSH_FXP_STATUS, Size: 22, Number: 1542
< 2023-05-17 11:44:35.765 Status code: 0
< 2023-05-17 11:44:35.780 Type: SSH_FXP_STATUS, Size: 22, Number: 1798
< 2023-05-17 11:44:35.781 Status code: 0
< 2023-05-17 11:44:35.781 Type: SSH_FXP_STATUS, Size: 22, Number: 2054
< 2023-05-17 11:44:35.781 Status code: 0
< 2023-05-17 11:44:35.781 Type: SSH_FXP_STATUS, Size: 22, Number: 2310
< 2023-05-17 11:44:35.781 Status code: 0
< 2023-05-17 11:44:35.781 Type: SSH_FXP_STATUS, Size: 22, Number: 2566
< 2023-05-17 11:44:35.781 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 2822
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 3078
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 3334
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 3590
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 3846
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 4102
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.790 Type: SSH_FXP_STATUS, Size: 22, Number: 4358
< 2023-05-17 11:44:35.790 Status code: 0
< 2023-05-17 11:44:35.806 Type: SSH_FXP_STATUS, Size: 22, Number: 4614
< 2023-05-17 11:44:35.806 Status code: 0
< 2023-05-17 11:44:35.806 Type: SSH_FXP_STATUS, Size: 22, Number: 4870
< 2023-05-17 11:44:35.806 Status code: 0
< 2023-05-17 11:44:35.806 Type: SSH_FXP_STATUS, Size: 22, Number: 5124
< 2023-05-17 11:44:35.806 Status code: 0
> 2023-05-17 11:44:35.806 Type: SSH_FXP_RENAME, Size: 66, Number: 5394
< 2023-05-17 11:44:35.902 Type: SSH_FXP_STATUS, Size: 47, Number: 5394
< 2023-05-17 11:44:35.902 Status code: 0
. 2023-05-17 11:44:35.902 Preserving timestamp [2023-05-17T07:37:57.000Z]
> 2023-05-17 11:44:35.902 Type: SSH_FXP_SETSTAT, Size: 42, Number: 1033
< 2023-05-17 11:44:36.039 Type: SSH_FXP_STATUS, Size: 22, Number: 1033
< 2023-05-17 11:44:36.039 Status code: 0
. 2023-05-17 11:44:36.039 Transfer done: '\\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230516.csv' => '/FRO098-20230516.csv' [239841]
. 2023-05-17 11:44:36.039 Copying finished: Transferred: 239,841, Elapsed: 0:00:00, CPS: 601,105/s
> 2023-05-17 11:44:36.039 Script: close
. 2023-05-17 11:44:36.039 Closing connection.
. 2023-05-17 11:44:36.039 Sending special code: 1
. 2023-05-17 11:44:36.070 Main session channel closed
. 2023-05-17 11:44:36.070 All channels closed

Here is my code:
cd C:\Program Files (x86)\WinSCP
winscp.exe /hostkey=ssh-rsa 2048 17Lasfasdgfvsdafgsdfgvsfgsdfsdgad /log=C:\Automate\Logs\D022_FTP_To_GlassLewis_%date:~-4,4%_%date:~-10,2%_%date:~7,2%.log /loglevel=0 /command "option batch abort" "option confirm off" "open sftp://<uid>:<pswd>@ftp.glasslewis.com/ -rawsettings FSProtocol=2" "put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv" close "exit"
if %ERRORLEVEL% equ 0 (
 echo SUCCESS
 exit /b 0
) else (
  echo ERROR FTP Problem
 exit /b 1
)
close "exit"

It might be a stupid thing that I can't see but am hoping you will help me. I am new to this FTP.
Thank you.
retlacs

Status Code

Hi,
FTP is giving a status code = 2 and am not sure why?

Here is the log:
It is at this line:
< 2023-05-16 09:17:17.964 Status code: 2

2023-05-16 09:17:17.884 Script: Authenticated.
. 2023-05-16 09:17:17.884 --------------------------------------------------------------------------
. 2023-05-16 09:17:17.884 Using SFTP protocol.
. 2023-05-16 09:17:17.885 Doing startup conversation with host.
< 2023-05-16 09:17:17.885 Script: Starting the session...
> 2023-05-16 09:17:17.885 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2023-05-16 09:17:17.902 Type: SSH_FXP_VERSION, Size: 176, Number: -1
. 2023-05-16 09:17:17.902 SFTP version 6 negotiated.
. 2023-05-16 09:17:17.903 Server requests EOL sequence "\r\n".
. 2023-05-16 09:17:17.903 Server software: Cerberus FTP Server 11.1.0.0 (110100000) by Cerberus, LLC
. 2023-05-16 09:17:17.903 Server support information (supported2):
. 2023-05-16 09:17:17.903   Attribute mask: 2BD, Attribute bits: FF, Open flags: 7
. 2023-05-16 09:17:17.903   Access mask: 3, Open block vector: 0, Block vector: 0, Max read size: 0
. 2023-05-16 09:17:17.903   Attribute extensions (0)
. 2023-05-16 09:17:17.903   Extensions (2)
. 2023-05-16 09:17:17.903     check-file
. 2023-05-16 09:17:17.903     copy-file
. 2023-05-16 09:17:17.903 We will use UTF-8 strings as it is mandatory with SFTP version 4 and newer
. 2023-05-16 09:17:17.903 Getting current directory name.
. 2023-05-16 09:17:17.903 Getting real path for '.'
> 2023-05-16 09:17:17.903 Type: SSH_FXP_REALPATH, Size: 11, Number: 16
< 2023-05-16 09:17:17.922 Type: SSH_FXP_NAME, Size: 72, Number: 16
. 2023-05-16 09:17:17.923 Real path is '/'
. 2023-05-16 09:17:17.923 Startup conversation with host finished.
< 2023-05-16 09:17:17.923 Script: Session started.
< 2023-05-16 09:17:17.923 Script: Active session: [1] FRO098@ftp.glasslewis.com
> 2023-05-16 09:17:17.923 Script: put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv
. 2023-05-16 09:17:17.924 Copying 1 files/directories to remote directory "/" - total size: 238,997
. 2023-05-16 09:17:17.925   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
. 2023-05-16 09:17:17.925   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2023-05-16 09:17:17.925   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2023-05-16 09:17:17.925 File: '\\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230515.csv' [2023-05-16T07:25:40.635Z] [238997]
. 2023-05-16 09:17:17.927 Copying \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230515.csv to remote directory started.
. 2023-05-16 09:17:17.927 Binary transfer mode selected.
. 2023-05-16 09:17:17.927 Checking existence of file.
> 2023-05-16 09:17:17.927 Type: SSH_FXP_LSTAT, Size: 33, Number: 263
< 2023-05-16 09:17:17.946 Type: SSH_FXP_ATTRS, Size: 62, Number: 263
. 2023-05-16 09:17:17.946 File exists: FRO098-20230515.csv;-;238997;2023-05-16T07:25:40.000Z;4;"" [0];"" [0];rw-rw-rw-;1
. 2023-05-16 09:17:17.946 Checking existence of partially transferred file.
> 2023-05-16 09:17:17.946 Type: SSH_FXP_LSTAT, Size: 42, Number: 519
< 2023-05-16 09:17:17.964 Type: SSH_FXP_STATUS, Size: 55, Number: 519
< 2023-05-16 09:17:17.964 Status code: 2
. 2023-05-16 09:17:17.964 Opening remote file.
> 2023-05-16 09:17:17.964 Type: SSH_FXP_OPEN, Size: 51, Number: 771
< 2023-05-16 09:17:17.984 Type: SSH_FXP_HANDLE, Size: 47, Number: 771
> 2023-05-16 09:17:17.985 Type: SSH_FXP_WRITE, Size: 16379, Number: 1286
. 2023-05-16 09:17:17.992 14 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2023-05-16 09:17:17.992 Type: SSH_FXP_CLOSE, Size: 47, Number: 5124
< 2023-05-16 09:17:18.027 Type: SSH_FXP_STATUS, Size: 22, Number: 1286
< 2023-05-16 09:17:18.027 Status code: 0
< 2023-05-16 09:17:18.039 Type: SSH_FXP_STATUS, Size: 22, Number: 1542
< 2023-05-16 09:17:18.039 Status code: 0
< 2023-05-16 09:17:18.044 Type: SSH_FXP_STATUS, Size: 22, Number: 1798
< 2023-05-16 09:17:18.044 Status code: 0
< 2023-05-16 09:17:18.044 Type: SSH_FXP_STATUS, Size: 22, Number: 2054
< 2023-05-16 09:17:18.044 Status code: 0
< 2023-05-16 09:17:18.055 Type: SSH_FXP_STATUS, Size: 22, Number: 2310
< 2023-05-16 09:17:18.055 Status code: 0
< 2023-05-16 09:17:18.055 Type: SSH_FXP_STATUS, Size: 22, Number: 2566
< 2023-05-16 09:17:18.055 Status code: 0
< 2023-05-16 09:17:18.060 Type: SSH_FXP_STATUS, Size: 22, Number: 2822
< 2023-05-16 09:17:18.060 Status code: 0
< 2023-05-16 09:17:18.060 Type: SSH_FXP_STATUS, Size: 22, Number: 3078
< 2023-05-16 09:17:18.060 Status code: 0
< 2023-05-16 09:17:18.060 Type: SSH_FXP_STATUS, Size: 22, Number: 3334
< 2023-05-16 09:17:18.060 Status code: 0
< 2023-05-16 09:17:18.071 Type: SSH_FXP_STATUS, Size: 22, Number: 3590
< 2023-05-16 09:17:18.072 Status code: 0
< 2023-05-16 09:17:18.072 Type: SSH_FXP_STATUS, Size: 22, Number: 3846
< 2023-05-16 09:17:18.072 Status code: 0
< 2023-05-16 09:17:18.072 Type: SSH_FXP_STATUS, Size: 22, Number: 4102
< 2023-05-16 09:17:18.072 Status code: 0
< 2023-05-16 09:17:18.076 Type: SSH_FXP_STATUS, Size: 22, Number: 4358
< 2023-05-16 09:17:18.076 Status code: 0
< 2023-05-16 09:17:18.076 Type: SSH_FXP_STATUS, Size: 22, Number: 4614
< 2023-05-16 09:17:18.076 Status code: 0
< 2023-05-16 09:17:18.076 Type: SSH_FXP_STATUS, Size: 22, Number: 4870
< 2023-05-16 09:17:18.076 Status code: 0
< 2023-05-16 09:17:18.088 Type: SSH_FXP_STATUS, Size: 22, Number: 5124
< 2023-05-16 09:17:18.088 Status code: 0
> 2023-05-16 09:17:18.088 Type: SSH_FXP_REMOVE, Size: 29, Number: 5389
< 2023-05-16 09:17:18.108 Type: SSH_FXP_STATUS, Size: 22, Number: 5389
< 2023-05-16 09:17:18.108 Status code: 0
> 2023-05-16 09:17:18.108 Type: SSH_FXP_RENAME, Size: 66, Number: 5650
< 2023-05-16 09:17:18.198 Type: SSH_FXP_STATUS, Size: 47, Number: 5650
< 2023-05-16 09:17:18.198 Status code: 0
. 2023-05-16 09:17:18.198 Preserving timestamp [2023-05-16T07:25:40.000Z]
> 2023-05-16 09:17:18.198 Type: SSH_FXP_SETSTAT, Size: 46, Number: 1033
< 2023-05-16 09:17:18.254 Type: SSH_FXP_STATUS, Size: 22, Number: 1033
< 2023-05-16 09:17:18.254 Status code: 0
. 2023-05-16 09:17:18.254 Transfer done: '\\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098-20230515.csv' => '/FRO098-20230515.csv' [238997]
. 2023-05-16 09:17:18.255 Copying finished: Transferred: 238,997, Elapsed: 0:00:00, CPS: 722,045/s
> 2023-05-16 09:17:18.255 Script: close
. 2023-05-16 09:17:18.255 Closing connection.
. 2023-05-16 09:17:18.255 Sending special code: 1
. 2023-05-16 09:17:18.289 Main session channel closed
. 2023-05-16 09:17:18.290 All channels closed

Here is my code:
winscp.exe /hostkey=ssh-rsa 2048 17LgdjI/nxBPU6ZeYVWnbVWkKPOn11VqmGtNNRmAfzM /log=C:\Automate\Logs\D022_FTP_To_GlassLewis_%date:~-4,4%_%date:~-10,2%_%date:~7,2%.log /loglevel=0 /command "option batch abort" "option confirm off" "open sftp://<ID>:<xyz>@ftp.glasslewis.com" "put \\fcmcftp\FTP\Usr\Portia\ProxyHoldings\FRO098*.csv" close "exit"
if %ERRORLEVEL% equ 0 (
 echo SUCCESS
 exit /b 0
) else (
  echo ERROR FTP Problem
 exit /b 1
)
close "exit"

I am using the same FTP script for others but this is the only one failing with status code =2
Any help is appreciated.