SharpSsh を使用して、サーバーから SFTP にファイルを再帰的にダウンロードする必要があります。しかし、ファイル名またはディレクトリを特定する方法がわかりません。今はそうしています
static void recDir(string remotePath, string localPath)
{
Sftp _c = this.sftp;
ArrayList FileList = _c.GetFileList(remotePath);
FileList.Remove(".");
FileList.Remove("..");
for (int i = 0; i < FileList.Count; i++)
{
try
{
_c.Get(remotePath + "/" + FileList[i], localPath + "/" + FileList[i]);
Console.WriteLine("File: " + remotePath + "/" + FileList[i]);
}
catch (Exception e)
{
Console.WriteLine("Dir: " + remotePath + "/" + FileList[i]);
System.IO.Directory.CreateDirectory(localPath + "/" + FileList[i]);
recDir(remotePath + "/" + FileList[i], localPath + "/" + FileList[i]);
}
}
}
動作しますが、正しくないようです。