リモートサーバーからファイルをアップロードおよびダウンロードできるアプリケーションを作成しています。転送プロトコルとして sftp を使用しており、すべてのファイルとディレクトリをリストビューに一覧表示する必要があります。私はsftpに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();