Hi.
I'm having trouble downloading a file from IMDb's alternative interfaces FTP, which seems to have symlinks for files.
The error returned:
Error transferring file '/pub/mirrors/ftp.imdb.com/pub/aka-titles.list.gz'.
Real path and requested remote path do not match: "/.m/mirrors1l/ftp.imdb.com/pub/" "/pub/mirrors/ftp.imdb.com/pub/"
Copying files from remote side failed.
Searching through this forum, there are old posts from 2002 stating that symlinks are not supported, and then more recent posts, pointing to:
https://winscp.net/eng/docs/rawsettings and
Tried adding the rawsettings, but to no avail:
try
{
var sessionOptions = new SessionOptions
{
Protocol = Protocol.Ftp
};
sessionOptions.ParseUrl("ftp://anon:anon@ftp.funet.fi/");
sessionOptions.AddRawSettings("ResolveSymlinks", "1");
sessionOptions.AddRawSettings("FollowDirectorySymlinks", "1");
using (Session session = new Session())
{
session.FileTransferProgress += progressHandler;
session.Open(sessionOptions);
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
var transferResult = session.GetFiles(
"/pub/mirrors/ftp.imdb.com/pub/aka-titles.list.gz",
"c:\SomeFolder\aka-titles.list.gz",
false,
transferOptions);
transferResult.Check();
}
}
catch (Exception e)
{
Debug.WriteLine("Error: {0}", e);
}
Tried to see if I could get the translated symlink using
EnumerateRemoteFiles
or
ListDirectory
, but the file's
FullName
is still the symlinked path.
The only option I have so far, is to catch the exception, parse the
Message
to get the real path and make a second call to
GetFiles()
, which is as hacky as it gets.
Any pointers would be much appreciated.
/Chris