This project is read-only.

Urgent: ScpClient - How to download entire remote directory to local directory

Sep 20, 2013 at 6:05 PM
Hello All,

I am trying to download all files and sub-folder from a remote directory to local directory. For this I am using "ScpClient" and method name is "Download". Based on documentation (if I have not read it wrongly) it says "Downloads the specified directory from the remote host to local directory." But the same is not happening for me.

Below is the code, please let me know if I am doing any mistake. Any pointers/help are greatly appreciated (its urgent for a go-live project).
            public void TestSynchronisation(string hostaddress, string username, string password, string hostfolderpath, string destinationPath)
            using (var sftp = new ScpClient(hostaddress, username, password))

                DirectoryInfo dirInfo = new DirectoryInfo(destinationPath);
                sftp.Downloading += sftp_Downloading;
                sftp.ErrorOccurred += sftp_ErrorOccurred;
                sftp.Download(hostfolderpath, dirInfo);            }

        void sftp_ErrorOccurred(object sender, Renci.SshNet.Common.ExceptionEventArgs e)

        void sftp_Downloading(object sender, Renci.SshNet.Common.ScpDownloadEventArgs e)
PS: It does not throw any error either shows any progress via downloading event.

Sep 23, 2013 at 5:24 PM
I request to the board users/senior members reply (if it is a known issue).