首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >下载多个文件sharpSSH

下载多个文件sharpSSH
EN

Stack Overflow用户
提问于 2014-07-13 15:02:51
回答 1查看 472关注 0票数 1

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

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

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

代码语言:javascript
复制
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,但是我如何发送或放置多个文件呢?

EN

回答 1

Stack Overflow用户

发布于 2014-07-14 09:02:23

你可以使用directoryinfo和foreach循环。

代码语言:javascript
复制
 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;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24720310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档