5

リモートサーバーからファイルをアップロードおよびダウンロードできるアプリケーションを作成しています。転送プロトコルとして sftp を使用しており、すべてのファイルとディレクトリをリストビューに一覧表示する必要があります。私はsftpにsharpsshを使用しています。誰かが私を正しい方向に向けることができますか?

よろしくお願いします。

バス・ファン・ウーエン

4

1 に答える 1

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();
于 2010-11-23T00:17:10.273 に答える