@arvy_p: If the passive mode does not work, it's usually due to an FTP server or network misconfiguration.
See FTP Connection Modes (Active vs. Passive)
See FTP Connection Modes (Active vs. Passive)
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
FtpMode
to FtpMode.Active
in the SessionOptions
. In Passive mode, the file info comes across an unpredictable port, but in Active, it's always port 20.
*
to the filename is probably the best workaround. It makes WinSCP retrieve file data using a full directory listing (and filtering the files by the file mask), instead of using the SIZE
and MDTM
commands.
Can't get attributes of file '/s685114.SLBSE766_20170203030427'. Could not retrieve file information Requested action aborted: local error in processing
sessionOptions.AddRawSettings("FtpUseMlsd", "1");
*
to the file name, it works fine.
D:\Guidance
was one too much, because of the long string I didn't notice it:
/log=c:\temp\winscp.log /command "open sftp://catalogger:catalogger@10.12.3.1/home/catalogger -hostkey=""ssh-rsa 1024 xx:xx:xx:xx..."" -rawsettings FtpUseMlsd=1" "get attema_cataloggerdata.txt "D:\Guidance\Catalogger\Catalog\Update\ATT\" "exit"
"C:\Program Files (x86)\WinSCP\WinSCP.exe"
/log=c:\temp\winscp.log /command "open sftp://catalogger:catalogger@10.12.3.1/home/catalogger -hostkey=""ssh-rsa 1024 xx:xx:xx:xx..."" -rawsettings FtpUseMlsd=1" "get attema_cataloggerdata.txt D:\Guidance\Catalogger\Catalog\Update\ATT\" "exit"
. 2016-07-21 11:25:22.594 --------------------------------------------------------------------------
. 2016-07-21 11:25:22.594 WinSCP Version 5.7.7 (Build 6257) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2016-07-21 11:25:22.594 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2016-07-21 11:25:22.594 Log level: Normal
. 2016-07-21 11:25:22.594 Local account: BEHEERPC4\Beheerpc
. 2016-07-21 11:25:22.594 Working directory: C:\Windows\system32
. 2016-07-21 11:25:22.594 Process ID: 2060
. 2016-07-21 11:25:22.594 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /log=c:\temp\winscp.log /command "open sftp://catalogger:catalogger@10.12.3.1/home/catalogger -hostkey=""ssh-rsa 1024 d9:a1:7e:b4:63:b3:4f:f4:94:86:6f:a9:ed:c5:92:67"" -rawsettings FtpUseMlsd=1" "get attema_cataloggerdata.txt "D:\Guidance\Catalogger\Catalog\Update\ATT\" "exit"
. 2016-07-21 11:25:22.594 Time zone: Current: GMT+2, Standard: GMT+1 (West-Europa (standaardtijd)), DST: GMT+2 (West-Europa (zomertijd)), DST Start: 27-3-2016, DST End: 30-10-2016
. 2016-07-21 11:25:22.594 Login time: donderdag 21 juli 2016 11:25:22
. 2016-07-21 11:25:22.594 --------------------------------------------------------------------------
. 2016-07-21 11:25:22.594 Script: Retrospectively logging previous script records:
> 2016-07-21 11:25:22.594 Script: open sftp://catalogger:***@10.12.3.1/home/catalogger -hostkey="ssh-rsa 1024 d9:a1:7e:b4:63:b3:4f:f4:94:86:6f:a9:ed:c5:92:67" -rawsettings FtpUseMlsd=1
. 2016-07-21 11:25:22.595 --------------------------------------------------------------------------
. 2016-07-21 11:25:22.595 Session name: catalogger@10.12.3.1 (Ad-Hoc site)
. 2016-07-21 11:25:22.595 Host name: 10.12.3.1 (Port: 22)
. 2016-07-21 11:25:22.595 User name: catalogger (Password: Yes, Key file: No)
. 2016-07-21 11:25:22.595 Tunnel: No
. 2016-07-21 11:25:22.595 Transfer Protocol: SFTP
. 2016-07-21 11:25:22.595 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2016-07-21 11:25:22.595 Disable Nagle: No
. 2016-07-21 11:25:22.595 Proxy: none
. 2016-07-21 11:25:22.595 Send buffer: 262144
. 2016-07-21 11:25:22.595 SSH protocol version: 2; Compression: No
. 2016-07-21 11:25:22.595 Bypass authentication: No
. 2016-07-21 11:25:22.595 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2016-07-21 11:25:22.595 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2016-07-21 11:25:22.595 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2016-07-21 11:25:22.595 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2016-07-21 11:25:22.595 Simple channel: Yes
. 2016-07-21 11:25:22.595 Return code variable: Autodetect; Lookup user groups: A
. 2016-07-21 11:25:22.595 Shell: default
. 2016-07-21 11:25:22.595 EOL: 0, UTF: 2
. 2016-07-21 11:25:22.595 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2016-07-21 11:25:22.595 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2016-07-21 11:25:22.595 SFTP Bugs: A,A
. 2016-07-21 11:25:22.595 SFTP Server: default
. 2016-07-21 11:25:22.595 Local directory: default, Remote directory: /home/catalogger, Update: Yes, Cache: Yes
. 2016-07-21 11:25:22.595 Cache directory changes: Yes, Permanent: Yes
. 2016-07-21 11:25:22.595 DST mode: 1
. 2016-07-21 11:25:22.595 --------------------------------------------------------------------------
. 2016-07-21 11:25:22.595 Looking up host "10.12.3.1"
. 2016-07-21 11:25:22.595 Connecting to 10.12.3.1 port 22
. 2016-07-21 11:25:22.617 Server version: SSH-2.0-OpenSSH_5.1
. 2016-07-21 11:25:22.617 Using SSH protocol version 2
. 2016-07-21 11:25:22.617 We claim version: SSH-2.0-WinSCP_release_5.7.7
. 2016-07-21 11:25:22.619 Doing Diffie-Hellman group exchange
. 2016-07-21 11:25:22.621 Doing Diffie-Hellman key exchange with hash SHA-256
. 2016-07-21 11:25:23.850 Verifying host key rsa2 0x23,0xbcf72813731a70f5 a9b164776653f5fe 043aa55ea71b650f 9aed796c07e0815a 777cd23831413581 0dc72cbcc07f4117 9e4dc76f4f33d819 a8141628fa994627 7847e4a6c8c8af01 c82e85db0b077606 128e0fa6d9634cfc 4079b1374a665c03 bca3913ce2bc3453 af1937f37fa34cdf c117054619becb59 6168de9201b7cce1 with fingerprint ssh-rsa 1024 d9:a1:7e:b4:63:b3:4f:f4:94:86:6f:a9:ed:c5:92:67
. 2016-07-21 11:25:23.850 Host key matches configured key
. 2016-07-21 11:25:23.850 Host key fingerprint is:
. 2016-07-21 11:25:23.850 ssh-rsa 1024 d9:a1:7e:b4:63:b3:4f:f4:94:86:6f:a9:ed:c5:92:67
. 2016-07-21 11:25:23.850 Initialised AES-256 SDCTR client->server encryption
. 2016-07-21 11:25:23.850 Initialised HMAC-SHA1 client->server MAC algorithm
. 2016-07-21 11:25:23.850 Initialised AES-256 SDCTR server->client encryption
. 2016-07-21 11:25:23.851 Initialised HMAC-SHA1 server->client MAC algorithm
! 2016-07-21 11:25:23.891 Using username "catalogger".
. 2016-07-21 11:25:23.892 Attempting keyboard-interactive authentication
. 2016-07-21 11:25:23.895 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2016-07-21 11:25:23.895 Using stored password.
. 2016-07-21 11:25:23.900 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, <no prompt>)
. 2016-07-21 11:25:23.901 Ignoring empty SSH server authentication request
. 2016-07-21 11:25:23.901 Access granted
. 2016-07-21 11:25:23.901 Opening session as main channel
. 2016-07-21 11:25:23.904 Opened main channel
. 2016-07-21 11:25:23.942 Started a shell/command
. 2016-07-21 11:25:23.942 --------------------------------------------------------------------------
. 2016-07-21 11:25:23.942 Using SFTP protocol.
. 2016-07-21 11:25:23.942 Doing startup conversation with host.
> 2016-07-21 11:25:23.942 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2016-07-21 11:25:23.990 Type: SSH_FXP_VERSION, Size: 95, Number: -1
. 2016-07-21 11:25:23.990 SFTP version 3 negotiated.
. 2016-07-21 11:25:23.990 Unknown server extension posix-rename@openssh.com="1"
. 2016-07-21 11:25:23.990 Supports statvfs@openssh.com extension version "2"
. 2016-07-21 11:25:23.990 Unknown server extension fstatvfs@openssh.com="2"
. 2016-07-21 11:25:23.990 We believe the server has signed timestamps bug
. 2016-07-21 11:25:23.990 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2016-07-21 11:25:23.990 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2016-07-21 11:25:23.990 Changing directory to "/home/catalogger".
. 2016-07-21 11:25:23.990 Getting real path for '/home/catalogger'
> 2016-07-21 11:25:23.990 Type: SSH_FXP_REALPATH, Size: 25, Number: 16
< 2016-07-21 11:25:23.990 Type: SSH_FXP_NAME, Size: 53, Number: 16
. 2016-07-21 11:25:23.990 Real path is '/home/catalogger'
. 2016-07-21 11:25:23.991 Trying to open directory "/home/catalogger".
> 2016-07-21 11:25:23.991 Type: SSH_FXP_LSTAT, Size: 25, Number: 263
< 2016-07-21 11:25:23.991 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2016-07-21 11:25:23.991 Getting current directory name.
. 2016-07-21 11:25:23.991 Startup conversation with host finished.
< 2016-07-21 11:25:23.991 Script: Active session: [1] catalogger@10.12.3.1
> 2016-07-21 11:25:23.991 Script: get attema_cataloggerdata.txt D:\Guidance\Catalogger\Catalog\Update\ATT\ exit
. 2016-07-21 11:25:23.992 Listing file "attema_cataloggerdata.txt".
> 2016-07-21 11:25:23.992 Type: SSH_FXP_LSTAT, Size: 51, Number: 519
< 2016-07-21 11:25:23.993 Type: SSH_FXP_ATTRS, Size: 37, Number: 519
. 2016-07-21 11:25:23.993 attema_cataloggerdata.txt;-;211422;2016-07-21T05:12:04.000Z;"" [0];"" [0];rwxr-xr-x;0
. 2016-07-21 11:25:23.993 Listing file "D:\Guidance\Catalogger\Catalog\Update\ATT\".
> 2016-07-21 11:25:23.993 Type: SSH_FXP_LSTAT, Size: 68, Number: 775
< 2016-07-21 11:25:23.993 Type: SSH_FXP_STATUS, Size: 29, Number: 775
< 2016-07-21 11:25:23.993 Status code: 2, Message: 775, Server: No such file, Language:
< 2016-07-21 11:25:23.994 Script: Can't get attributes of file 'D:\Guidance\Catalogger\Catalog\Update\ATT\'.
< 2016-07-21 11:25:23.994 Script: No such file or directory.
< 2016-07-21 11:25:23.994 Error code: 2
< 2016-07-21 11:25:23.994 Error message from server: No such file
. 2016-07-21 11:25:23.994 Script: Failed
. 2016-07-21 11:25:23.994 Script: Exit code: 1
. 2016-07-21 11:25:23.994 Closing connection.
. 2016-07-21 11:25:23.994 Sending special code: 12
. 2016-07-21 11:25:23.995 Sent EOF message
# Upload files to remote directory, collect results
$UploadResult = $session.Putfiles($localPath, $remotePath, $True)
foreach ($upload in $synchronizationResult.Uploads)
{
# Success or error?
if ($upload.Error -eq $Null)
{
Write-Host ("Upload of {0} succeeded, removing from source" -f
$upload.FileName)
# Upload succeeded, remove file from source
$removalResult = $session.RemoveFiles($session.EscapeFileMask($upload.FileName))
if ($removalResult.IsSuccess)
{
Write-Host ("Removing of file {0} succeeded" -f
$upload.FileName)
}
else
{
Write-Host ("Removing of file {0} failed" -f
$upload.FileName)
}
}
rm
command, which is designed to remove remote files.
put -delete ...
. 2016-04-13 07:53:45.373 Transfer done: 'C:\ftp\myplumbingshowroom\test2.txt' [5]
> 2016-04-13 07:53:45.842 Script: rm -- "C:\ftp\myplumbingshowroom\test2.txt"
. 2016-04-13 07:53:45.842 Listing file "C:\ftp\myplumbingshowroom\test2.txt".
. 2016-04-13 07:53:45.842 Retrieving file information...
> 2016-04-13 07:53:45.842 PWD
< 2016-04-13 07:53:45.983 257 "/" is current directory.
> 2016-04-13 07:53:45.983 CWD /C:\ftp\myplumbingshowroom\test2.txt
< 2016-04-13 07:53:46.139 550 The parameter is incorrect.
> 2016-04-13 07:53:46.139 TYPE I
< 2016-04-13 07:53:46.280 200 Type set to I.
> 2016-04-13 07:53:46.280 SIZE /C:\ftp\myplumbingshowroom\test2.txt
< 2016-04-13 07:53:46.436 550 The parameter is incorrect.
. 2016-04-13 07:53:46.436 Could not retrieve file information
< 2016-04-13 07:53:46.436 Script: Can't get attributes of file 'C:\ftp\myplumbingshowroom\test2.txt'.
< 2016-04-13 07:53:46.436 Script: Could not retrieve file information
< 2016-04-13 07:53:46.436 The parameter is incorrect.
. 2016-04-13 07:53:46.436 Script: Failed
> 2016-04-13 07:53:46.873 Script: exit
. 2016-04-13 07:53:46.873 Script: Exit code: 1
. 2016-04-13 07:53:46.873 Disconnected from server
Session.SessionLogPath
. 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.Can't get attributes of file '/Test/data.csv'.
GetFiles("Testfile.xls*", "/downloaddir/")
Testfile.xls
Testfile.xls.backup
open ftp://anonymous@192.168.2.100:2121/66DATA99/Input/BocceLog/ -rawsettings FtpUseMlsd=1
MLSD
. With that said I'm totally new to FTP so in all probability it's working as it should.
MLST
in your log from the other post:
Meanwhile you can workaround the bug by configuring WinSCP to avoidMLST
command.
For that you have to upgrade to WinSCP 5.6 beta and set Use MLSD command for directory listing to Off.
MLST
still appeared in the log, so it appears MLSD = Off does not affect MLST
. On a positive note using an *
in a shortened filename led to success.
> 2015-08-26 15:39:24.335 SIZE /budget_out.txt
< 2015-08-26 15:39:24.351 550 Could not get file size.
Can't get attributes of file 'budget_out.txt'.
Could not retrieve file information
Could not get file size.
2015-08-26 15:39:24.054 --------------------------------------------------------------------------
. 2015-08-26 15:39:24.054 WinSCP Version 5.7.5 (Build 5665) (OS 6.3.9600 - Windows Server 2012 R2 Datacenter)
. 2015-08-26 15:39:24.054 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2015-08-26 15:39:24.054 Log level: Normal
. 2015-08-26 15:39:24.054 Local account: ***********************
. 2015-08-26 15:39:24.054 Working directory: C:\Donnees\RSS
. 2015-08-26 15:39:24.054 Process ID: 4872
. 2015-08-26 15:39:24.054 Command-line: "c:\winscp\WinSCP.exe" /console=575 /consoleinstance=_1912_411 "/command" "open ftp://**********************/" "get budget_out.txt" "exit" "/log=C:\ftpscp.log"
. 2015-08-26 15:39:24.054 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/8/2015, DST End: 11/1/2015
. 2015-08-26 15:39:24.054 Login time: Wednesday, August 26, 2015 3:39:24 PM
. 2015-08-26 15:39:24.054 --------------------------------------------------------------------------
. 2015-08-26 15:39:24.054 Script: Retrospectively logging previous script records:
> 2015-08-26 15:39:24.054 Script: open ftp://*******************/
. 2015-08-26 15:39:24.054 --------------------------------------------------------------------------
. 2015-08-26 15:39:24.054 Session name: ***************(Ad-Hoc site)
. 2015-08-26 15:39:24.054 Host name: **************** (Port: 21)
. 2015-08-26 15:39:24.054 User name: ****** (Password: Yes, Key file: No)
. 2015-08-26 15:39:24.054 Transfer Protocol: FTP
. 2015-08-26 15:39:24.054 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2015-08-26 15:39:24.054 Disable Nagle: No
. 2015-08-26 15:39:24.054 Proxy: none
. 2015-08-26 15:39:24.054 Send buffer: 262144
. 2015-08-26 15:39:24.054 UTF: 2
. 2015-08-26 15:39:24.054 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2015-08-26 15:39:24.054 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2015-08-26 15:39:24.054 Cache directory changes: Yes, Permanent: Yes
. 2015-08-26 15:39:24.054 Timezone offset: 0h 0m
. 2015-08-26 15:39:24.054 --------------------------------------------------------------------------
. 2015-08-26 15:39:24.069 Connecting to ***************...
. 2015-08-26 15:39:24.085 Connected with ***************. Waiting for welcome message...
< 2015-08-26 15:39:24.116 220 (vsFTPd 2.0.5)
> 2015-08-26 15:39:24.116 USER *******
< 2015-08-26 15:39:24.132 331 Please specify the password.
> 2015-08-26 15:39:24.132 PASS *********
< 2015-08-26 15:39:24.163 230 Login successful.
> 2015-08-26 15:39:24.163 SYST
< 2015-08-26 15:39:24.194 215 UNIX Type: L8
> 2015-08-26 15:39:24.194 FEAT
< 2015-08-26 15:39:24.210 211-Features:
< 2015-08-26 15:39:24.210 EPRT
< 2015-08-26 15:39:24.226 EPSV
< 2015-08-26 15:39:24.226 MDTM
< 2015-08-26 15:39:24.226 PASV
< 2015-08-26 15:39:24.226 REST STREAM
< 2015-08-26 15:39:24.226 SIZE
< 2015-08-26 15:39:24.226 TVFS
< 2015-08-26 15:39:24.226 211 End
. 2015-08-26 15:39:24.226 Connected
. 2015-08-26 15:39:24.226 --------------------------------------------------------------------------
. 2015-08-26 15:39:24.226 Using FTP protocol.
. 2015-08-26 15:39:24.226 Doing startup conversation with host.
> 2015-08-26 15:39:24.241 PWD
< 2015-08-26 15:39:24.257 257 "/"
. 2015-08-26 15:39:24.257 Getting current directory name.
. 2015-08-26 15:39:24.257 Startup conversation with host finished.
< 2015-08-26 15:39:24.257 Script: Active session: [1] **************
> 2015-08-26 15:39:24.257 Script: get budget_out.txt
. 2015-08-26 15:39:24.257 Listing file "budget_out.txt".
. 2015-08-26 15:39:24.257 Retrieving file information...
> 2015-08-26 15:39:24.257 PWD
< 2015-08-26 15:39:24.288 257 "/"
> 2015-08-26 15:39:24.288 CWD /budget_out.txt
< 2015-08-26 15:39:24.304 550 Failed to change directory.
> 2015-08-26 15:39:24.304 TYPE I
< 2015-08-26 15:39:24.335 200 Switching to Binary mode.
> 2015-08-26 15:39:24.335 SIZE /budget_out.txt
< 2015-08-26 15:39:24.351 550 Could not get file size.
. 2015-08-26 15:39:24.351 Could not retrieve file information
< 2015-08-26 15:39:24.351 Script: Can't get attributes of file 'budget_out.txt'.
< 2015-08-26 15:39:24.351 Script: Could not retrieve file information
< 2015-08-26 15:39:24.351 Could not get file size.
. 2015-08-26 15:39:24.351 Script: Failed
. 2015-08-26 15:39:24.351 Script: Exit code: 1
. 2015-08-26 15:39:24.351 Disconnected from server
/log=path_to_log_file
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.*
in file name I've got
Error listing directory '/MyDirName'.
500 Internal Server Error
A)bort, (R)etry, (S)kip: Abort
Can't get attributes of file 'MyFileName.zip'.
500 Internal Server Error
/log=path_to_log_file
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.get file.rar.aes
Can't get attributes of file (filename)
get file.rar*.aes
MLST
and MLSD
, and required a data connection for MLST
... The bug has been fixed.
ftp.hrivehq.com
server.
MLST
command.
MLST
command, but only since 5.6 beta:
ftp.drivehq.com
. Will there be a fix for this situation?
Can't get attributes of file (filename).
Invalid argument to date encode.