2016-04-07 23 views
1

私はFTP経由でフォルダをコピーしようとしているWindows 2012サーバを持っています。フォルダには複数のフォルダがあり、サイズは約12 GBです。 ツリー構造全体をコピーするのに使用できるコマンドは、その内部のすべてのフォルダとファイルを含みます。WindowsでFTP経由でフォルダをコピーする

  • このフォルダは圧縮できません。
  • また、私はmget*を使用しようとしましたが、すべて フォルダのすべてのファイルをコピーしますが、フォルダ構造は作成されません。
  • プロンプトに「無効なコマンド」が表示されるため、TARコマンドを使用できません。
+0

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

答えて

2

WindowsコマンドラインFTPクライアントのftp.exeは、再帰的なディレクトリ転送をサポートしていません。


これには、第三者のFTPクライアントを使用する必要があります。それは自動的に/folder内のすべてのファイルとサブフォルダをダウンロードします

winscp.com /command^
    "open ftp://user:[email protected]/"^
    "get /folder/* c:\target\"^
    "exit" 

WinSCP FTP clientとたとえば、次のようなバッチファイルを使用することができます。

詳細については、WinSCPガイドautomating file transfers from FTP serverを参照してください。 Windows ftp.exe script to WinSCPを変換するためのガイドもあります。

(私はWinSCPのの著者です)

-1

ターゲットディレクトリは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); 
    } 

}

関連する問題