GetFiles() transfers empty File

Advertisement

Chaos
Joined:
Posts:
1

GetFiles() transfers empty File

Hi Guys,
I'm starting with the WINSCP Lib and it looks quite good.
Now I'm using the WinSCP Client to compare what I am doing.
I have a simple text file on an sftp with a few lines of content; when I transfer it, it arrives beeing an empty file.
Here is the code I use:

 using (var session = Connect())
            {
                if(!session.FileExists(fileName))
                {
                    throw new FileNotFoundException(fileName);
                }
                var tmp = Path.GetTempFileName();
                var result = session.GetFiles(fileName, tmp);
                if(!result.IsSuccess)
                {
                    throw new AggregateException(result.Failures);
                }
                return tmp;
            }

found it, its evil!
Session.FileExists will return true for a relative path
Session.GetFiles will just create an empty file
[/b]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,478
Location:
Prague, Czechia

Re: GetFiles() transfers empty File

Chaos wrote:

found it, its evil!
Session.FileExists will return true for a relative path
Session.GetFiles will just create an empty file
[/b]
Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set 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.

Reply with quote

Advertisement

You can post new topics in this forum