Sharpssh目录列表

Bas*_*ash 5 c# sftp sharpssh

我正在编写一个允许我从远程服务器上传和下载文件的应用程序.我使用sftp作为我的传输协议,我需要将所有文件和目录列入listview.我正在使用sharpssh进行sftp.有人能指出我正确的方向吗?

谢谢你,

Bas van Ooyen

Gab*_*ães 13

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();
Run Code Online (Sandbox Code Playgroud)