2

Closed

SCP : Missing files when using DirectoryUpload

description

Hi,I have the following environment:- Win7 / 64- .NET 3.5- MPC-Target :OpenSSH_6.0p1, OpenSSL 1.0.0j 10 May 2012- SSH.NET commit 19813I want to upload a directory structure (recursive, depth = 2) from the PC to a MPC basedLinux remote system. The total amount of data is about 8MB with 23 files from55 bytes to 4MB.Calling mScp.Upload(new DirectoryInfo(localDir), remoteDir) does not result anyerror and the Uploading event shoes uploading all files. But after Upload() returnedThere are a random number of missing files on the target (between 1 and 5).It tried the same with a PC based Linux as target what resulted in the same behaviour(OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011). It seems theproblem is caused anywhere within SSH.NET.Does anyone have a solution?Extension:I tried to workaround by replacing Upload(new DirectoryInfo(...)) by several singlecalls of Upload(new FileInfo(...)). This worked but is too slow for my application.
Closed by

comments

olegkap wrote Dec 21, 2012 at 12:06 AM

Can you post a code that you using to do it?
I don't think I added support to upload directory using Upload function.

Thanks,
Oleg

TheCloudlessSky wrote Feb 26 at 4:16 PM

@Oleg,
  1. This issue is still not fixed (even in the latest source). The issue is not the same as being able to upload a rooted directory. I have the exact same issue as the OP: I'm uploading a directory that has multiple files/nested directories and files randomly do not get uploaded:

    using (var scp = new ScpClient("host", "user", "password"))
    {
    scp.Connect();
    
    scp.Uploading += (s, e) =>
    {
        Console.WriteLine("UPLOAD -> " + e.Filename + ", Size=" + e.Size + ", Uploaded=" + e.Uploaded);
    };
    
    var directory = new DirectoryInfo(@"c:\toupload");
    
    scp.Upload(directory, "xyz");
    
    scp.Disconnect();
    }
This prints the upload message for every file - but doesn't actually upload all of the files!

TheCloudlessSky wrote Feb 26 at 4:17 PM

Sorry for the messed up formatting...

Schmid wrote Feb 27 at 5:53 AM

Hi Oleg,

I think you really intended to support uploading / downloading a directory:
ScpClient.Upload(DirectoryInfo directoryInfo, string filePath);
ScpClient.Download(string filePath, DirectoryInfo directoryInfo);

Please, please fix the problem.

Thanks,
Ulrich

TheCloudlessSky wrote Mar 6 at 12:32 PM

Oleg,

Any chance of getting this fixed? This has completely blocked us from using your library and we've had to resolve to using the old Tamir.SharpSSH library that is terribly slow!

olegkap wrote Mar 6 at 1:12 PM

Hey guys,
I briefly looked at it but under one scenario that I checked it worked so I think what happens here is that I need to think about all possible scenarios and address them appropriately.

I guess I might look into Tamir library for solution example but unfortunately I don't have much free time right now.

I will defiantly will try to fix it as soon as possible.

Thanks,
Oleg

TheCloudlessSky wrote Mar 6 at 1:56 PM

Oleg,

I think having multiple nested directories/files might be the cause of this. I really do appreciate a fix for this when you have the time. Cheers!

Schmid wrote Mar 7 at 9:54 AM

Oleg,

I also still have to live with the very slow workaround by transfering file by file.
Please spend some more time for finding and fixing the bug.

Thanks
Ulrich

olegkap wrote Mar 7 at 3:18 PM

Hi,

Can you please check 23466 commit and see if it fixed that?
I made some changes to upload logic and I hope it should resolved issue of missing files too, since I cannot duplicate this issue locally.

Thanks,
Oleg

TheCloudlessSky wrote Mar 7 at 5:42 PM

Hi Oleg,

That commit did not fix the missing file issue :(. I don't know a lot about the SSH/SCP protocols, but I'm going to spend some time adding some debug statements to see what's up.

TheCloudlessSky wrote Mar 7 at 6:19 PM

Also - I would be glad to privately send you the files we're uploading that seem to "cause issues".

olegkap wrote Mar 7 at 7:13 PM

Yea, sure, feel free to send me your files so I could try it here as well.

Also, I would suggest to put debug meesages after lines where it sends D0755, C0644 and E commands.
This could give a better picture of what files or directories it tried to copy, then if you can, attach this output with your directory tree structure so I could try to analyze it.

Thanks,
OIeg