0
C#でFluentFTPを使用してFTP転送を実装しようとしています。 ディレクトリのリストを取得するのは簡単ですが、ファイルをダウンロードするにはどうすればよいですか?FluentFTPを使用してファイルをダウンロード
C#でFluentFTPを使用してFTP転送を実装しようとしています。 ディレクトリのリストを取得するのは簡単ですが、ファイルをダウンロードするにはどうすればよいですか?FluentFTPを使用してファイルをダウンロード
FluentFTPの最新バージョンには、DownloadFile()
とUploadFile()
のメソッドが組み込まれています。 https://github.com/robinrodricks/FluentFTP#example-usageから
使用例:
// connect to the FTP server
FtpClient client = new FtpClient();
client.Host = "123.123.123.123";
client.Credentials = new NetworkCredential("david", "pass123");
client.Connect();
// upload a file
client.UploadFile(@"C:\MyVideo.mp4", "/htdocs/big.txt");
// rename the uploaded file
client.Rename("/htdocs/big.txt", "/htdocs/big2.txt");
// download the file again
client.DownloadFile(@"C:\MyVideo_2.mp4", "/htdocs/big2.txt");