SCP copy to a specific folder

Dec 23, 2011 at 2:07 PM

Hi all,

  I'm try to use SCPClient to copy from a windows machine to a unix machine into an specific folder, I'm doing this.

var tmpWorkingDirectory =@"c:\someFolderWithTheFiles"

var directoryInfo = new DirectoryInfo(tmpWorkingDirectory);

var localFiles = directoryInfo.GetFiles();

ConnectionInfo connectionInfo = new PasswordConnectionInfo(Server, User, Password);

 ScpClient scpClient = new ScpClient(connectionInfo);

scpClient.Connect();

for (var i = 0; i < localFiles.Length; i++)

{

var remoteFileName = "/103123/waa/c2/folder/" + localFiles[i].Name;               

scpClient.Upload(localFiles[i], remoteFileName);      

}

 scpClient.Disconnect();

 

But when I'm in the upload part, I get this error...

scp: error: unexpected filename: /103123/waa/c2/client_id/file1.txt

I also try added the user@serverName:/103123/waa/c2/client_id/ and I got the same problem, If anybody can gimme a hand on that, I will really apreciate it,

 

Thanks,

Raúl.

 

 

 

Coordinator
Dec 24, 2011 at 1:43 PM

Hi,

 

SCP is pretty new feature, so I might have some bugs in there,

but what it seems is that it expects full path when you passing the name so check and see if /103123/waa/c2/client_id/file1.txt is full path name and

/103123/waa/c2/client_id/ folder exists.

 

Thanks,

Oleg

Dec 24, 2011 at 2:13 PM

Hi Oleg, thanks a lot for your reply.

So you think that I should send only the folder name without the file name?

Something like this? 

for (var i = 0; i < localFiles.Length; i++)

{

/*var remoteFileName = "/103123/waa/c2/folder/" + localFiles[i].Name;*/

var remoteFolderName = "/103123/waa/c2/folder/"

scpClient.Upload(localFiles[i], remoteFolderName);      

}

Thanks,

Raúl.

 

 

Coordinator
Dec 24, 2011 at 2:49 PM

sorry for confusion,

I just looked at my test code and it seems that you need specifie folder based on the home directory of logged in user.

Here some of my tests that I was doing while developing this feature.

			using (var scp = new ScpClient(connectionInfo))
			{
				scp.Connect();
				scp.Downloading += delegate(object sender, ScpDownloadEventArgs e)
				{
					Console.WriteLine(e.Filename + ":" + e.Size + ":" + e.Downloaded);
				};

				scp.Uploading += delegate(object sender, ScpUploadEventArgs e)
				{
					Console.WriteLine(e.Filename + ":" + e.Size + ":" + e.Uploaded);
				};

				scp.Upload(File.OpenRead(@"D:\scp.test\test.txt"), "data1.xml");
				scp.Download("data1.xml", File.OpenWrite(@"D:\scp.test\downloaded.txt"));
				scp.Download("test_id_rsa.pub", new FileInfo(@"D:\scp.test\test.txt"));
				scp.Download("testdir", new DirectoryInfo(@"D:\scp.test"));
				scp.Download("test", new FileInfo(@"D:\scp.test\test1mb"));
				scp.Download("openssh-4.2/ssh/", new DirectoryInfo(@"D:\scp.test"));
				scp.Download("testdir1", new DirectoryInfo(@"D:\scp.test"));
				scp.Upload(new FileInfo(@"D:\scp.test\test.txt"), "uploadtest");
				scp.Upload(new DirectoryInfo(@"D:\scp.test\test"), "uploaddir");
				scp.Upload(new FileInfo(@"D:\scp.test\test1mb"), "test1mb");

				scp.Disconnect();
			}

 

Hope it helps.

 

Thanks,

Oleg

Dec 26, 2011 at 1:42 PM

Oleg,

 So you are telling me that I can't copy files into a specific folder rather that the one that I see when I start the session on the remote host?

 

Thanks a lot for your help,

Raúl.

Coordinator
Dec 26, 2011 at 3:04 PM

Hi,

 

This is what I tested so far.

I will try to see how and if I can do a copy into specific file/folder.

I will let you know as soon as I find something out.

 

Thanks,

Oleg

Jan 11, 2012 at 3:10 PM

I've found a workaround if you are interested in one.

In the first Upload method in ScpClient.NET.cs, change the following line:

channel.SendExecRequest(string.Format("scp -qt {0}", file));

To this:

channel.SendExecRequest(string.Format("cd {0};", directorypath) + string.Format("scp -qt {0}", filename));

- Sonny

Coordinator
Jan 11, 2012 at 3:32 PM

Well,

 

Yea, you can do that, but you can also specify a full path to the file and it should work.

I did  a test locally here and it worked fine, as long as I specify correct full path.

 

For example this line worked just fine:

				scp.Download("/home/tester/testupload.txt", new FileInfo(@"D:\scp.test\testupload.txt"));

Thanks,

Oleg

Jan 11, 2012 at 4:38 PM

Thanks a lot Oleg and Sonny,

  I will make the work around and see how it goes.

 Oleg. I put the complete full path for the Upload method and send the errors that I show you before, I haven't try to make a Download, I will give a shot,

 

Thanks,

Raúl.

 

Feb 7, 2012 at 9:05 PM

hey not sure if this is ok but I test the workaround and works like a charm

here is the complete method:

public void Upload(FileInfo fileInfo, string filePath)
{
    using (var input = new PipeStream())
    using (var channel = this.Session.CreateChannel<ChannelSession>())
    {
        channel.DataReceived += delegate(object sender, Common.ChannelDataEventArgs e)
        {
            input.Write(e.Data, 0, e.Data.Length);
            input.Flush();
        };

        channel.Open();

        //  Send channel command request
        string directoryPath = filePath.Substring(0, filePath.LastIndexOf('/') + 1);
        string filename = filePath.Substring(filePath.LastIndexOf('/') + 1);

        if (String.IsNullOrEmpty(directoryPath))
            channel.SendExecRequest(string.Format("scp -qt {0}", filename));
        else
            channel.SendExecRequest(string.Format("cd {0};", directoryPath) + string.Format("scp -qt {0}", filename));
        this.CheckReturnCode(input);

        this.InternalUpload(channel, input, fileInfo, filename);

        channel.Close();
    }
}

Mar 9, 2012 at 9:48 AM

thanks redled.it was really helpful.

Apr 11, 2012 at 2:06 PM

Hi,

thanks for the code snippet. It works fine - but only if the destination folder still exists.

If the folder is not available, no error code or other information comes up.

Thanks,

Balin

 

Coordinator
Apr 13, 2012 at 12:52 PM

Hi,

 

It should throw an exception, well, if its reported by the server of course.

Can you post your code and I will try it here and see what happens?

 

Thanks,

Oleg

Apr 16, 2012 at 8:20 AM

Hi,

since the original code didn't work, I used the modified code for the Upload procedure as shown above.

In a first step, I simply want to copy a shell script from a windows computer onto a Linux computer. (A second step will execute the script, but this part works fine).

The connection will be established by

        cnnInfo = new ConnectionInfo(_hostname, 22, _username, passwdConnection);

which also works fine.

If I use an existing directory, like "/tmp", the command will work; using a non-existend directory, like "tmp1", nothing happens, no error occurs and no exception will be thrown.

        private bool CopyCheckEnv(ConnectionInfo cnnInfo) { 
            FileInfo scriptInfo = new FileInfo("c:\\Temp\\script"));
            if ( ! scriptInfo.Exists) {
                return false;
            }
 
            ScpClient scp = new ScpClient(cnnInfo);
            string targetPath "/tmp1/script";
            try {
                scp.Connect();
                if (!scp.IsConnected) {
                    return false;
                }
            }
            catch (Exception ex) {
                return false;
            }
 
            try {
                scp.Upload(scriptInfo.OpenRead(), targetPath);
                scp.Disconnect();
            }
            catch (Exception ex) 
                return false;
            }
            return true;
        }


Thank you for your assistance,
Balin                

(P.S.: You made a fine piece of software and I appreciate it very much!)
Apr 20, 2012 at 12:27 PM
Edited Apr 20, 2012 at 12:32 PM
To solve this you need to do the following... 

Change the function Spec to receive the path as a parameter (to simplify splitting paths at last / character) ... then you change the SendExecRequest to
channel.SendExecRequest(string.Format("scp -qt \"{0}\"", path));

The scp command seems to accept the path
scp -qt <path>
and then we provide filename and permissions as follow
C0644 <length> <filename>
public void Upload(FileInfo fileInfo, string path, string filename)
        {
            using (var input = new PipeStream())
            using (var channel = this.Session.CreateChannel<ChannelSession>())
            {
                channel.DataReceived += delegate(object sender, Common.ChannelDataEventArgs e)
                {
                    input.Write(e.Data, 0, e.Data.Length);
                    input.Flush();
                };

                channel.Open();

                //  Send channel command request
                channel.SendExecRequest(string.Format("scp -qt \"{0}\"", path));
                this.CheckReturnCode(input);

                this.InternalUpload(channel, input, fileInfo, filename);

                channel.Close();
            }
        }
Jun 14, 2012 at 4:34 PM

I would really like to see nuxtech's method added to the base build.

Coordinator
Jun 18, 2012 at 1:23 PM

Hi,

 

I just applied this change in 17223.

Please take a look and let me know if you have any problems.

 

I applied quotes for all SCP operations as well, to keep it consistent.

 

Thanks,

Oleg

Oct 15, 2012 at 6:34 AM

After the fix of 17223 I still get an error

scp: error: unexpected filename: /tmp/myfile.dat

when trying to upload to an absolute path on the target (whic is Ubuntu 11.04 (GNU/Linux 2.6.37-bu armv7l).

For me it is fixed by changing line 237 in ScpClient.cs from

 

this.SendData(channel, string.Format("C0644 {0} {1}\n", length, filename));

 

to 

 

this.SendData(channel, string.Format("C0644 {0} {1}\n", length, Path.GetFileName(filename)));

 

i.e. stripping the leading directory. The file ends up the correct place anyway.

 

Dec 10, 2012 at 12:05 PM

Hello

I also cannot apply destination folder/filename. I'm trying to upload bytes, I don't have file. So I would like to put destination folder and file name. But when I'm choosing filename as: tmp/myfile.txt I have an error unexpected filename, the same problem is with absolte path /tmp/myfile.txt

 

Coordinator
Dec 20, 2012 at 12:34 PM

Hi,

Thanks for finding the path issue.

 

I applied your fix so you could be available to everybody.

 

Thanks,

Oleg

Jan 8, 2013 at 9:16 PM

Hi all - I may be encountering the same issue with directories, otherwise its an untrapped usage error.

In ScpClient.NET.cs:

private void InternalUpload(ChannelSession channel, PipeStream input, DirectoryInfo directoryInfo, string directoryName)
{
            this.InternalSetTimestamp(channel, input, directoryInfo.LastWriteTimeUtc, directoryInfo.LastAccessTimeUtc);
            this.SendData(channel, string.Format("D0755 0 {0}\n", directoryName));
            this.CheckReturnCode(input);

 ...

 

The same 'unexpected filename' error is caught in CheckReturnCode. I might be talking toss here, since I don't know the SSH protocol, but I think that SendData D0755 instruction doesn't like a full path since it works if I supply a single directory name, without slashes, but I everything ends up in my home directory.

This quick rework seems to be okay:

        private void InternalUpload(ChannelSession channel, PipeStream input, DirectoryInfo sourceDirectoryInfo, string destinationDirectoryPath)
        {
            this.InternalSetTimestamp(channel, input, sourceDirectoryInfo.LastWriteTimeUtc, sourceDirectoryInfo.LastAccessTimeUtc);

            this.SendData(channel, string.Format("D0755 0 {0}\n", Path.GetFileName(destinationDirectoryPath)));
            this.CheckReturnCode(input);

            //  Upload files
            var sourceFiles = sourceDirectoryInfo.GetFiles();
            foreach (var sourceFile in sourceFiles)
            {
                string destinationPath = Path.Combine(destinationDirectoryPath, sourceFile.Name).Replace(@"\", @"/");

                this.InternalUpload(channel, input, sourceFile, destinationPath);
            }

            //  Upload directories
            var sourceDirectories = sourceDirectoryInfo.GetDirectories();
            foreach (var sourceDirectory in sourceDirectories)
            {
                string destinationPath = Path.Combine(destinationDirectoryPath, sourceDirectory.Name).Replace(@"\", @"/");

                this.InternalUpload(channel, input, sourceDirectory, destinationPath);
            }

            this.SendData(channel, "E\n");
            this.CheckReturnCode(input);
        }

Coordinator
Jan 9, 2013 at 1:21 AM

Hi,

 

I just did a small test but I managed to upload full directory structure as it is and without making any code changes.

May be server that I am using is ok with that so will have to dig into what the standart

Also, I cannot apply this change :

 

string destinationPath = Path.Combine(destinationDirectoryPath, sourceDirectory.Name).Replace(@"\", @"/");

 

 

Since using "/" is usually operating system specific and it might not work everywhere.

 

I will try to dig more into standards and see what I can find.

 

Thanks,

Oleg

Jan 10, 2013 at 2:12 PM

Oh, you've seen this. Sorry, I didn't make a proper issue to track.

I'm on Debian Linux uktnlx01 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686

I've seen other people with this error (not with SshNet but other hacking around) and they solved it by taking out the path sent along with the D0755. The fix was indicative, so if you have a more robust idea then go for it, although I have no idea how to determine the path separator for a remote SSH system, I just assume a Linux style /

 

Cheers Oleg.

Coordinator
Jan 10, 2013 at 2:29 PM

From what I was checking, currently I do not send directory path but only directory name.

I used to have it in a past but I think few people complaint that it doesnt work, so I dont provide full path now in D0755 request but only directory name.

I was also trying to look into putty scp code and what I understood is that they using directory name only too.

So I guess currently I am not sure how correctly to address this problem, may be some flags that indicate wheither to include directory name or not.

 

Any suggestions would be appreciated.

 

Thanks,

Oleg

Jan 12, 2013 at 4:32 PM

Hi Oleg,

When you say "I don't provide full path *now* in D0755 request" what do you mean by now? The version I downloaded - I don't know the version, the assembly version isn't baked into the AssemblyInfo.cs, but it was around 2 days before I posted the original problem - sends the full path under my test conditions.

Have you changed the code since I posted here, or maybe we're not running the same original test conditions.

Luke

Coordinator
Jan 13, 2013 at 10:31 PM

Hi,

 

I guess it was not entirely correct then,

Recently, I mean like month or while ago, so those changes are already included.

Why incorrect, because I made a change to use only filename instead of full path for files only not for directory.

When I was testing it, it was using directory name only, not full path already, so thats why I never made a change for directory.

What server do you use, may be in some cases server returns full path name instead of directory only.

I can look at it again then may be later this week.

Since I could not experience the same problem have other questions.

Did you try that example on other different server what was the behavior there?

 

Thanks,

Oleg

Jan 14, 2013 at 10:23 AM

Hi Oleg

Linux uktnlx01 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686

The above distro causes the error for copying directories with path delimiters /

 

I've not tried on any others. I work with CentOS available. I'll be honest, I've lost track of what you'd like me to check on which distro? When I get time later this week I'll download your latest and check for problems with files and folders on Debian and CentOS.

Luke

Coordinator
Jan 14, 2013 at 7:47 PM

Hi,

On my servers, including CentOS that I have, I manged to upload directory correctly without providing a full path when uploading file or directory.

So I guess I have a problem with recreating the problem you described :( so I am not sure what what be the best way to try to resolve this.

 

Thanks,

Oleg

Jan 21, 2013 at 3:16 PM

Same problem here:

trying to copy from Win7 into subfolder in Mac OS X 10.7.5 (11G63)

with

      using (var transfer = new ScpClient(connectionInfo))
      {
        transfer.Connect();
        transfer.Upload(new System.IO.DirectoryInfo("D:\\Temp\\Test"), "test/testsub");
        transfer.Disconnect();
      }

results in "scp: error: unexpected filename: test/testsub

 

Same with fully qualified path:         transfer.Upload(new System.IO.DirectoryInfo("D:\\Temp\\Test"), "/Users/demo/test/testsub");

results in "scp: error: unexpected filename: /Users/Demo/test/testsub

 

Changing InternalUpload to

        private void InternalUpload(ChannelSession channel, PipeStream input, DirectoryInfo directoryInfo, string directoryName)
        {
            this.InternalSetTimestamp(channel, input, directoryInfo.LastWriteTimeUtc, directoryInfo.LastAccessTimeUtc);

            var dirPath = Path.GetFileName(directoryName);
            this.SendData(channel, string.Format("D0755 0 {0}\n", dirPath ));
            this.CheckReturnCode(input);

            //  Upload files
            var files = directoryInfo.GetFiles();
            foreach (var file in files)
            {
                this.InternalUpload(channel, input, file, Path.Combine(dirPath, file.Name));
            }

            //  Upload directories
            var directories = directoryInfo.GetDirectories();
            foreach (var directory in directories)
            {
                this.InternalUpload(channel, input, directory, Path.Combine(dirPath,directory.Name));
            }

            this.SendData(channel, "E\n");
            this.CheckReturnCode(input);
        }

does the trick ... mostly.

It however still fails if the target path consists of more than one folder and the first folder of the chain is missing in the target system.

doing an explicit
                channel.SendExecRequest(string.Format("mkdir -p \"{0}\"", directoryName));

within its own channel

            using (var input1 = new PipeStream())
            using (var channel1 = this.Session.CreateChannel<ChannelSession>())
            {
                channel1.DataReceived += delegate(object sender, Common.ChannelDataEventArgs e)
                {
                    input1.Write(e.Data, 0, e.Data.Length);
                    input1.Flush();
                };

                channel1.Open();

                channel1.SendExecRequest(string.Format("mkdir -p \"{0}\"", directoryName));

                channel1.Close();
            }

solves this as well - not overly elegant, but functional :)

Coordinator
Jan 23, 2013 at 1:22 PM

Hi,

 

Sorry for delay.

 

Thanks for describing the problem again, I guess I just didnt get the problem earlier.

So the issue is when you trying to upload file or directory into subdirectory or file located in subdirectory.

If so I think I have a more elegant SCP style solution but will need some time to implement it as I will be busy with other project.

 

Thanks,

Oleg

Jan 23, 2013 at 1:25 PM

Oleg, I don't mean to neglect you, I'm a bit snowed right now but I'll await your new solution.

Coordinator
Jan 23, 2013 at 1:32 PM

No it's ok,

I am actually now understand better what is the problem so I could work on better solution since I personally dot use SCP feature so I dont try a lot of situation.

Thanks,

Oleg

Coordinator
Jan 24, 2013 at 9:42 PM

Hey guys,

 

I just committed a fix for this problem.

Please check out 22670 commit.

 

Now you can use path in you when upload file(s) and it should create the structure on the server if it doesnt exists.

 

Please test and let me know if it works or if you having other issues with it.

 

Thanks,

Oleg

Jan 25, 2013 at 8:04 AM

Okay dude, I'm using this lib with some PowerShell functions/scripts I've written, like Copy-ToSshSession which are then used by a TeamCity deployment script. When its all cooked, I'll replace my tweaked lib with 22670 and see if my TeamCity projects end up in the right places ;)

Jan 31, 2013 at 8:23 PM
Edited Jan 31, 2013 at 8:37 PM
I'm not sure if this is related.....
I'm using 2013.1.27 and i'm getting a file not found error. Source file exists and destination directory exists. It worked fine with sharpssh but i'm trying out this component and its not working.

I've tried:-

SCP1.Connect()
Dim f As New FileInfo(strTempFileName)
SCP1.Upload(f, "/etc/directory/")

also tried:-

SCP1.Connect()
Dim f As New FileInfo(strTempFileName)
SCP1.Upload(f, "/etc/directory/filename.txt")

Both gave the same error:-

"Renci.SshNet.Common.ScpException: scp: : No such file or directory
at Renci.SshNet.ScpClient.Upload(FileSystemInfo fileSystemInfo, String path)
at AMI_Client.clsAMIClient.ProcessorCode() in D:\HostingSpaces2\admin\com\Services\Source Files\VoIP\VoIP AMI Client\clsAMIClient.vb:line 189"

Any ideas?
Thanks
Coordinator
Feb 2, 2013 at 2:43 PM
Hi,

Yes,
I looked at it and it seems when I did last changed I fully forgot about situation where path is rooted and started with "/"

I just committed a code, 22896, that should handle this situation so please check it out and let me know if it works.

Thanks,
Oleg
Feb 13, 2013 at 11:42 AM
Hi,

I have the same problem as journo, where im getting folowing error: "scp: : No such file or directory", but i cant find your latest committed code, 22896, where can i find it?

Thanks
Coordinator
Feb 13, 2013 at 1:37 PM
Hi,

You simply need to download it from "SOURCE CODE" tab above.

Thanks,
Oleg
Feb 14, 2013 at 8:48 AM
Hi
I'm using your latest commit 22965 and i still get af file not found error. The source file and destination directory exists.

I've tried:
            client.Connect();

            Stream filestream = new FileStream("filename.zip", FileMode.Open, FileAccess.Read); 
            client.Upload(filestream, "/dir/sdcard/"); 
            filestream.Close();

            client.Disconnect();
When i excecute the upload command i get an exception: "scp: : No such file or directory" in line 344 in ScpClient.cs

Renci.SshNet.Common.ScpException was unhandled by user code
Message=scp: : No such file or directory
Source=Renci.SshNet
StackTrace:
   at Renci.SshNet.ScpClient.CheckReturnCode(Stream input)
   at Renci.SshNet.ScpClient.Upload(Stream source, String path)
   at LinkTest.LinkTestFixture.TestUploadLatestFirmwareToLink() in 
C:\Users\k\Desktop\Link\Pc\trunk\LinkTest\LinkTest\LinkTestFixture.cs:line 184 InnerException:

Do you any suggestions to how to solve this problem?
Thanks
Coordinator
Feb 14, 2013 at 1:41 PM
Hi,

I think you using this incorrectly.
It seems that you trying to upload stream into the folder which is obviously impossible.
I would change this line:
client.Upload(filestream, "/dir/sdcard/filename.zip"); 
To point to specific file.

Hope it helps.

Thanks,
Oleg
Feb 15, 2013 at 3:35 PM
Edited Feb 15, 2013 at 3:35 PM
Hi Oleg,

The fix in 22896 works for uploading a file, but doesn't work when uploading a directory:
using (var c = new ScpClient("host", "user", "password"))
{
    c.Connect();
    var di = new DirectoryInfo(@"c:\toupload");
    // FAILS - scp: error: unexpected filename: /var/wwwroot
    c.Upload(di, "/var/wwwroot"); 
    c.Disconnect();
}
Coordinator
Mar 7, 2013 at 3:16 PM
Hi,

Can you please check 23466 commit and see if it fixed that?
I made some change to the logic and it worked correctly in my test.

Thanks,
Oleg
Mar 7, 2013 at 4:29 PM
Hi Oleg,

That works great for uploading to a specific directory! However, there is a slight bug: if the destination path does not end with a "/", it is uploaded to a nested directory:
scp.Upload(dirInfo, "/var/wwwroot");
// uploads dirInfo to:
/var/wwwroot/wwwroot/
Coordinator
Mar 7, 2013 at 5:36 PM
Hi,

I just tested and actually in my case both tests:
scp.Upload(new DirectoryInfo(@"D:\test1"), "/AAA/oleg");
and
scp.Upload(new DirectoryInfo(@"D:\test1"), "/AAA/oleg/");
In those both cases it uploaded into the same folder /AAA/oleg.

From what I was checking with unix sys admin is that some unix implementation differentiate if target has a trailing slash or not.
On my test machine it looks like it doesn't matter but on some it appears it does, since what I heard is that this is expected behavior.

So I guess in this case its probably not a bug but server specific implementation behavior.

I would suggest to try out different OS systems to see what would be the difference in behavior if any.
Also, to test you server behavior I would use command line SCP utility and see how it behaves and let me know if its different from library behavior.

Hope it helps,
Thanks,
Oleg
Mar 7, 2013 at 5:42 PM
Edited Mar 7, 2013 at 5:42 PM
.
Mar 7, 2013 at 5:42 PM
Edited Mar 7, 2013 at 5:45 PM
Yes - you are correct. I did not know this. Thanks!
May 3, 2013 at 12:59 AM
Edited May 3, 2013 at 2:24 AM
Hi olgkap.

I tried many differnce OS that the Ubuntu, CentOS and openBSD.

But i have received same error "scp no such a file or directory"

I used the implement ver at 7.4.2013.

please check below my source.

FileStream fs = new FileStream(@"Y:\uploadfile.txt", FileMode.Open);
ScpClient scpClient_ciao = new ScpClient("ubuntu1", "user", "password");
scpClient_ciao.Connect();
fs.Position = 0;
scpClient_ciao.Upload(fs, "/export/user/Downloads/uploadfile.txt");
//scpClient_ciao.Upload(fs, "/export/user/Downloads/uploadfile/"); // same error occured
scpClient_ciao.Disconnect();
fs.Close();
May 7, 2013 at 7:46 AM
Edited May 7, 2013 at 7:46 AM
Hi,

i'm using 2013.1.27 and i try to copy a file from a windows to a linux machine.
My copy command looks like:
m_Scp.Upload(fi, sTargetDir + fi.Name);
where sTargetDir is "update/". My copied file pops up on the linux machine within directory ~/update/update/.
Looks like a bug.

If i use "./update/" everything works fine.

Thanks - Markus