Sharpssh 目录列表 [英] Sharpssh directory listing
本文介绍了Sharpssh 目录列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个应用程序,它允许我从远程服务器上传和下载文件.我使用 sftp 作为我的传输协议,我需要将所有文件和目录列出到列表视图中.我正在使用sharpssh进行sftp.有人能指出我正确的方向吗?
I'm writing an application that allows me to up- and download 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?
谢谢转发,
Bas van Ooyen
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();
这篇关于Sharpssh 目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文