开发者

Sharpssh directory listing

开发者 https://www.devze.com 2023-01-04 10:32 出处:网络
I\'m writing an application that allows me to up- and down开发者_开发技巧load files from a remote server. I\'m using sftp as my transfer protocol and i need to list all files and directory\'s into a l

I'm writing an application that allows me to up- and down开发者_开发技巧load files from a remote server. I'm using sftp as my transfer protocol and i need to list all files and directory's into a listview. I'm using sharpssh for sftp. Can somebody point me into the right direction?

Thanks in forward,

Bas van Ooyen


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号