我正在编写一个应用程序,允许我从远程服务器上传和下载文件。我使用 sftp 作为传输协议,我需要将所有文件和目录列出到列表视图中。我使用 Sharpssh 作为 sftp。有人能指出我正确的方向吗?
感谢转发,
巴斯·范·乌延
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();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)