Side Kick Asked:2020-08-19 14:53:00 +0000 UTC2020-08-19 14:53:00 +0000 UTC 2020-08-19 14:53:00 +0000 UTC 如何从ftp服务器下载zip文件?[关闭] 772 如何以编程方式通过 ftp 从远程服务器下载具有特定名称的多个 zip 文件? c# 1 个回答 Voted Best Answer Igor Chubin 2020-08-19T14:56:26Z2020-08-19T14:56:26Z 这是您使用以下命令从 FTP 服务器下载文件的方式WebClient: private void DownloadFileFTP() { string inputfilepath = @"C:\Temp\FileName.exe"; string ftphost = "xxx.xx.x.xxx"; string ftpfilepath = "/Updater/Dir1/FileName.exe"; string ftpfullpath = "ftp://" + ftphost + ftpfilepath; using (WebClient request = new WebClient()) { request.Credentials = new NetworkCredential("UserName", "P@55w0rd"); byte[] fileData = request.DownloadData(ftpfullpath); using (FileStream file = File.Create(inputfilepath)) { file.Write(fileData, 0, fileData.Length); file.Close(); } MessageBox.Show("Download Complete"); } } 有关该主题的其他材料: https://stackoverflow.com/questions/2781654/ftpwebrequest-download-file _ https://stackoverflow.com/questions/12519290/downloading-files-using-ftpwebrequest_ _
这是您使用以下命令从 FTP 服务器下载文件的方式
WebClient:有关该主题的其他材料: