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

Re: Could not retrieve file information

You have to use absolute paths with .NET assembly.
pluijpers

Could not retrieve file information

Error retrieving a file from the Bloomberg FTP site. I am able to retieve a directory listing and check that the required files exists on the FTP site, however when retrieving the file using GetFiles I receive an error message
-- WinSCP Version 5.2.1 (Build 3231) (OS 6.1.7601 Service Pack 1)

> 2013-06-18 11:33:12.041 Script: get  -nopermissions -preservetime -transfer="binary" -- "./f4387audt.ext.130614.1" "T:\DataWarehouse\Bloomberg\AUDT\20130614_AUDT.txt"
. 2013-06-18 11:33:12.041 Listing file "./f4387audt.ext.130614.1".
. 2013-06-18 11:33:12.041 Retrieving file information...
> 2013-06-18 11:33:12.041 MLST /./f4387audt.ext.130614.1
< 2013-06-18 11:33:15.057 500 Syntax error, command unrecognized.
. 2013-06-18 11:33:15.057 Could not retrieve file information
< 2013-06-18 11:33:15.057 Script: Can't get attributes of file './f4387audt.ext.130614.1'.
< 2013-06-18 11:33:15.057 Script: Could not retrieve file information
< 2013-06-18 11:33:15.057 Syntax error, command unrecognized.
. 2013-06-18 11:33:15.057 Script: Failed

Retrieving the same file using the UI version WinSCP UI works without issues.
I have the following C# code (simplified) in V2010 .NET4.0, which works for other FTP sites.
this.sessionOptions = new SessionOptions();

this.sessionOptions.Protocol = WinSCP.Protocol.Ftp;
this.sessionOptions.FtpMode = FtpMode.Active;
this.sessionOptions.HostName = host;
this.sessionOptions.PortNumber = port;
this.sessionOptions.UserName = user;
this.sessionOptions.Password = password;
           
this.session = new Session();
this.session.SessionLogPath = Path.Combine(Environment.CurrentDirectory, AppDomain.CurrentDomain.FriendlyName + "_Log.txt");

string localFile = Path.Combine(localFilePath, string.IsNullOrEmpty(localFileName) ? fileInfo.Name : localFileName);
string remoteFile = "./" + fileInfo.Name;
TransferOperationResult result = this.session.GetFiles(remoteFile, localFile);
if (!result.IsSuccess) { // ERROR. }


How do I fix this error as I would like to use one solution for FTP and SFTP.

Thank you,
Patrick