Unable to download entire remote directory to local directory - ScpClient

Oct 2, 2013 at 5:40 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)
It does not throw any error either shows any progress via downloading event.