Sharpssh Directory List

I am writing an application that allows me to upload and download files from a remote server. I use sftp as my transfer protocol, and I need to list all the files and directory in listview. I am using sharpssh for sftp. Can someone point me in the right direction?

Thanks, go ahead

Bass van oyen

+5
source share
1 answer
Sftp sftp = new Sftp(serverUri.Host, userName, password);

sftp.Connect();

//the foldername cannot be empty, or the listing will not show
ArrayList res = sftp.GetFileList("/foldername");
foreach (var item in res)
{
    if (item.ToString() != "." && item.ToString() != "..")
        Console.WriteLine(item.ToString());
}

sftp.Close();
+12
source

All Articles