ターゲットディレクトリはzipファイルです。次のコードを使用して、完全なzipファイルをftpサーバーにコピーできます。
//Taking source and target directory path
string sourceDir = FilePath + "Files\\" + dsCustomer.Tables[0].Rows[i][2].ToString() + "\\ConfigurationFile\\" + dsSystems.Tables[0].Rows[j][0].ToString() + "\\XmlFile";
string targetDir = FilePath + "Files\\Customers\\" + CustomerName + "\\" + SystemName + "\\";
foreach (var srcPath in Directory.GetFiles(sourceDir))
{
//Taking file name which is going to copy from the sourcefile
string result = System.IO.Path.GetFileName(srcPath);
//If that filename exists in the target path
if (File.Exists(targetDir + result))
{
//Copy file with a different name(appending "Con_" infront of the original filename)
System.IO.File.Copy(srcPath, targetDir + "Con_" + result);
}
//If not existing filename
else
{
//Just copy. Replace bit is false here. So there is no overwiting.
File.Copy(srcPath, srcPath.Replace(sourceDir, targetDir), false);
}
}
http://stackoverflow.com/questions/14630932/windows-command-line-ftp-to-deploy-website、http://superuser.com/questions/133380/use -mput-to-transfer-a-directory-using-ftp – CodeCaster