我有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,但是我如何发送或放置多个文件呢?
发布于 2014-07-14 09:02:23
你可以使用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;
}https://stackoverflow.com/questions/24720310
复制相似问题