C# Sharpssh目录列表

C# Sharpssh目录列表,c#,sftp,sharpssh,C#,Sftp,Sharpssh,我正在编写一个应用程序,它允许我从远程服务器上传和下载文件。我使用sftp作为我的传输协议,我需要将所有文件和目录列在列表视图中。我正在为sftp使用sharpssh。谁能给我指出正确的方向吗 谢谢转发 Bas van Ooyen我基本上做了同样的事情。。。我正在更新我们在上使用的一些SharpSSH代码 Sftp sftp = new Sftp(serverUri.Host, userName, password); sftp.Connect(); //the foldername can

我正在编写一个应用程序,它允许我从远程服务器上传和下载文件。我使用sftp作为我的传输协议,我需要将所有文件和目录列在列表视图中。我正在为sftp使用sharpssh。谁能给我指出正确的方向吗

谢谢转发


Bas van Ooyen

我基本上做了同样的事情。。。我正在更新我们在上使用的一些SharpSSH代码
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();