Post a reply

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

martin

The GUI uses MLSD to retrieve the file list (which I assume works). When you then select a file to download, it does not need to read its attributes again, as it knows them from the listing.

While the script does not know the attributes of the file, so it asks for them using the MLST command. For some reasons, your FTP server fails that.
frieder.hirrle@...

OK, thanks. :-)
But it runs, when I transfer the same file in WinSCP-GUI.
What is the difference between scripting and "working by hand"?
martin

Your server is refusing to provide information about the file you are trying to download:

> 2020-09-18 20:43:56.044 MLST /Volume_2/Test1.txt
< 2020-09-18 20:43:56.044 550 Can't check for file existence

Please contact your server administrator to ask why.
FHirrle

Here is the log:

. 2020-09-18 20:43:55.981 --------------------------------------------------------------------------
. 2020-09-18 20:43:55.981 WinSCP Version 5.17.7 (Build 10640) (OS 10.0.18363 - Windows 10 Enterprise)
. 2020-09-18 20:43:55.981 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2020-09-18 20:43:55.981 Log level: Normal
. 2020-09-18 20:43:55.981 Local account: STS\Frieder
. 2020-09-18 20:43:55.981 Working directory: C:\Users\Frieder
. 2020-09-18 20:43:55.981 Process ID: 14020
. 2020-09-18 20:43:55.981 Command-line: "C:\Program Files (x86)\WinSCP3\WinSCP.exe" /console=5.17.7 /consoleinstance=_3816_221 "/log=winscp.log" "/script=d:\temp\ftp\skripte\get.txt"
. 2020-09-18 20:43:55.981 Time zone: Current: GMT+2, Standard: GMT+1 (Mitteleuropäische Zeit), DST: GMT+2 (Mitteleuropäische Sommerzeit), DST Start: 29.03.2020, DST End: 25.10.2020
. 2020-09-18 20:43:55.981 Login time: Freitag, 18. September 2020 20:43:55
. 2020-09-18 20:43:55.981 --------------------------------------------------------------------------
. 2020-09-18 20:43:55.981 Script: Retrospectively logging previous script records:
> 2020-09-18 20:43:55.981 Script: open ftp://USERNAME:***@80.151.240.132/ -rawsettings ProxyPort=0
. 2020-09-18 20:43:55.981 --------------------------------------------------------------------------
. 2020-09-18 20:43:55.981 Session name: USERNAME@80.151.240.132 (Ad-Hoc site)
. 2020-09-18 20:43:55.981 Host name: 80.151.240.132 (Port: 21)
. 2020-09-18 20:43:55.981 User name: USERNAME (Password: Yes, Key file: No, Passphrase: No)
. 2020-09-18 20:43:55.981 Transfer Protocol: FTP
. 2020-09-18 20:43:55.981 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2020-09-18 20:43:55.981 Disable Nagle: No
. 2020-09-18 20:43:55.981 Proxy: None
. 2020-09-18 20:43:55.981 Send buffer: 262144
. 2020-09-18 20:43:55.981 UTF: Auto
. 2020-09-18 20:43:55.981 FTPS: None [Client certificate: No]
. 2020-09-18 20:43:55.981 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2020-09-18 20:43:55.981 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2020-09-18 20:43:55.981 Cache directory changes: Yes, Permanent: Yes
. 2020-09-18 20:43:55.981 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2020-09-18 20:43:55.981 Timezone offset: 0h 0m
. 2020-09-18 20:43:55.981 --------------------------------------------------------------------------
. 2020-09-18 20:43:55.981 Connection with 80.151.240.132 is established ...
. 2020-09-18 20:43:55,997 Connected to 80.151.240.132. welcome message is expected …
< 2020-09-18 20:43:56.003 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
< 2020-09-18 20:43:56.003 220-You are user number 1 of 10 allowed.
< 2020-09-18 20:43:56.003 220-Local time is now 19:43. Server port: 21.
< 2020-09-18 20:43:56.003 220-IPv6 connections are also welcome on this server.
< 2020-09-18 20:43:56.003 220 You will be disconnected after 10 minutes of inactivity.
> 2020-09-18 20:43:56.003 USER USERNAME
< 2020-09-18 20:43:56.013 331 User USERNAME OK. Password required
> 2020-09-18 20:43:56.013 PASS ********
< 2020-09-18 20:43:56.029 230 OK. Current restricted directory is /
> 2020-09-18 20:43:56.029 SYST
< 2020-09-18 20:43:56.029 215 UNIX Type: L8
> 2020-09-18 20:43:56.029 FEAT
< 2020-09-18 20:43:56.029 211-Extensions supported:
< 2020-09-18 20:43:56.029 EPRT
< 2020-09-18 20:43:56.029 IDLE
< 2020-09-18 20:43:56.029 MDTM
< 2020-09-18 20:43:56.029 SIZE
< 2020-09-18 20:43:56.029 REST STREAM
< 2020-09-18 20:43:56.029 MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*;
< 2020-09-18 20:43:56.029 MLSD
< 2020-09-18 20:43:56.029 ESTP
< 2020-09-18 20:43:56.029 PASV
< 2020-09-18 20:43:56.029 EPSV
< 2020-09-18 20:43:56.029 SPSV
< 2020-09-18 20:43:56.029 ESTA
< 2020-09-18 20:43:56.029 AUTH TLS
< 2020-09-18 20:43:56.029 PBSZ
< 2020-09-18 20:43:56.029 PROT
< 2020-09-18 20:43:56.029 211 End.
. 2020-09-18 20:43:56.029 connected
. 2020-09-18 20:43:56.029 --------------------------------------------------------------------------
. 2020-09-18 20:43:56.029 Using FTP protocol.
. 2020-09-18 20:43:56.029 Doing startup conversation with host.
> 2020-09-18 20:43:56.029 PWD
< 2020-09-18 20:43:56.044 257 "/" is your current location
. 2020-09-18 20:43:56.044 Getting current directory name.
. 2020-09-18 20:43:56.044 Startup conversation with host finished.
< 2020-09-18 20:43:56.044 Script: Aktive Sitzung: [1] USERNAME@80.151.240.132
> 2020-09-18 20:43:56.044 Script: cd /Volume_2
. 2020-09-18 20:43:56.044 Cached directory change via "/Volume_2" to "/Volume_2".
. 2020-09-18 20:43:56.044 Getting current directory name.
< 2020-09-18 20:43:56.044 Script: /Volume_2
> 2020-09-18 20:43:56.044 Script: lcd D:\Temp\FTP
< 2020-09-18 20:43:56.044 Script: D:\Temp\FTP
> 2020-09-18 20:43:56.044 Script: get Test1.txt
< 2020-09-18 20:43:56.044 Script: Configured transfer settings are used, deviating from the manufacturer's specifications.
. 2020-09-18 20:43:56.044 Listing file "Test1.txt".
. 2020-09-18 20:43:56.044 File information is retrieved …
> 2020-09-18 20:43:56.044 MLST /Volume_2/Test1.txt
< 2020-09-18 20:43:56.044 550 Can't check for file existence
. 2020-09-18 20:43:56.044 File information not retrievable
< 2020-09-18 20:43:56.060 Script: The attributes for the file "Test1.txt" cannot be determined.
< 2020-09-18 20:43:56.060 File information not retrievable

< 2020-09-18 20:43:56.060 Can't check for file existence
. 2020-09-18 20:43:56.060 Script: Failed
. 2020-09-18 20:43:56.060 Script: Exit code: 1
. 2020-09-18 20:43:56.060 Connection to remote computer will be closed

I hope it helps.
martin

Re: WinSCP-generated Script creates error messages

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
FHirrle

WinSCP-generated Script creates error messages

Hello,

I'm new on WinSCP automation / skripting.
So I used the feature to create a skript for my task.
To test it, I want to download 1 specific file "Test1.txt" from a remote folder to a local folder.
The script looks like this:
open ftp://username:password@80.151.240.132/ -rawsettings ProxyPort=0
 
cd /Volume_2
lcd D:\Temp\FTP
get Test1.txt
 
exit

and I start WinSCP like this:
winscp.com /script="d:\temp\ftp\skripte/get.txt"

But the result is:

Connection with 80.151.240.132 is established ...
Connected
The session is started ...
Session started.
Active session: [1] username@80.151.240.132
/Volume_2
D:\Temp\FTP
Configured transfer settings are used, deviating from the manufacturer's specifications.
The attributes for the file "Test1.txt" cannot be determined.
File information cannot be retrieved
Can't check for file existence

So what to do?

Thanks for your help. :-)