I am attempting to script a file transfer which fails due to security restrictions on the remote server. It appears that WinSCP is sending unnecessary commands during this process. Transferring through the GUI works fine.
In the log excerpt below, it seems that the highlighted commands are not necessary. Is there any way to prevent these commands or am I missing something fundamental?
***
Command-line: "C:\WinSCP\WinSCP.exe" /loglevel=0 /log=C:\Temp\WinSCP.log /command "open ftps://FTPUSER:***@257.257.257.257:21/ -explicit -rawsettings MinTlsVersion=12 PostLoginCommands=PBSZ%200%0ASITE%20REC=FB%20LRECL=94%0AEPSV%0APROT%20P" "cd home" "put ""C:\Temp\File.txt"" -transfer=ascii" "exit"
***
Script: TLS connection established. Waiting for welcome message...
TLS connection established. Waiting for welcome message...
USER FTPUSER
331 Send password please.
PASS ********
FTPUSER is logged on. Working directory is "FTPUSER.".
SYST
500 User Exit denies Userid 'FTPUSER' from using Command 'SYST'.
FEAT
User Exit denies Userid 'FTPUSER' from using Command 'FEAT'.
PBSZ 0
Protection buffer size accepted
PROT P
200 Data connection protection set to private
Script: Connected
Connected
--------------------------------------------------------------------------
Using FTP protocol.
Doing startup conversation with host.
Script: Starting the session...
PBSZ 0
200 Protection buffer size accepted
SITE REC=FB LRECL=94
200 SITE command was accepted
EPSV
229 Entering Extended Passive Mode (|||28624|)
PROT P
200 Data connection protection set to private
PWD
257 "'FTPUSER.'" is working directory.
Getting current directory name.
Startup conversation with host finished.
Script: Session started.
Script: Active session: [1] FTPUSER@257.257.257.257
Script: cd home
Cached directory change via "home" to "/'USR.XXXXX.'".
Getting current directory name.
Script: /'USR.XXXXX.'
Script: put "C:\Temp\File.txt" -transfer=ascii
Copying 1 files/directories to remote directory "/'USR.XXXXX.'" - total size: 960
PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask:
TM: A; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
File: 'C:\Temp\File.txt' [2022-10-18T15:48:01.116Z] [960]
Copying "C:\Temp\File.txt" to remote directory started.
Ascii transfer mode selected.
Starting upload of C:\Temp\File.txt
CWD /'USR.XXXXX.'
500 User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
CWD /
500 User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Copying files to remote side failed.
(ExtException) **Copying files to remote side failed.**
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Asking user:
Error transferring file 'C:\Temp\File.txt'. ("Copying files to remote side failed.","User Exit denies Userid 'FTPUSER' from using Command 'CWD'.")
Script: Error transferring file 'C:\Temp\File.txt'.
Script: Copying files to remote side failed.
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Answer: Abort
(ESkipFile) Error transferring file 'C:\Temp\File.txt'.
Copying files to remote side failed.
User Exit denies Userid 'FTPUSER' from using Command 'CWD'.
Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
Script: Failed
Script: Exit code: 1
Disconnected from server