【问题标题】:Download multiple files sharpSSH下载多个文件 sharpSSH
【发布时间】:2014-07-13 07:02:50
【问题描述】:

我有 6 个文件要从 Windows 复制到 Linux:input.dat、image1.tif、image2.tif、image3.tif、image4.tif、image5.tif

我正在使用 SharpSSH,现在我知道如何复制单个文件,但我的问题是无论如何我可以使用SharpSSH 复制多个文件,而不是一个一个地复制它们?

这是我复制一个文件的代码:

Sftp sshFTP;
string localPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\input.dat";
string remotePath = "/home/mowglin/working_directory";
this.sshFTP.Put(localPath, remotePath);

现在这工作正常,它将 input.dat 文件复制到 Linux,但我又如何发送或放置多个文件?

【问题讨论】:

  • 上传后压缩文件并解压如何?

标签: c# wpf linux sharpssh


【解决方案1】:

您可以使用 directoryinfo 和 foreach 循环。

 DirectoryInfo d  = new DirectoeyInfo( directory where you get your files)
 FileInfo[] Files = d.GetFiles("*");

foreach(FileInfo file in Files)
{
    //put your code here
    //your remote path should be "/home/mowglin/working_directoey/" + file.name;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多