以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何从FTP中批量下载文件 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=98358) |
-- 作者:农村人 -- 发布时间:2017/3/28 16:18:00 -- 如何从FTP中批量下载文件 如何从FTP指定的目录,自动下载本地目录没有的文件. |
-- 作者:有点色 -- 发布时间:2017/3/28 17:11:00 -- 循环ftp的文件列表,然后查询本地是否存在
http://www.foxtable.com/webhelp/scr/1410.htm
http://www.foxtable.com/webhelp/scr/0337.htm
|
-- 作者:农村人 -- 发布时间:2017/3/28 17:22:00 -- 感谢您的回复. 我通过以下代码: Dim ftp1 As New FtpClient Dim fls As List(of String) ftp1.Host="IP地址*****" ftp1.Account = "用户名***" ftp1.Password = "密码***" fls = ftp1.GetFileList("\\gaoshengde") For Each fl As String In fls Dim Values As New List(Of String) Values.Add(fl) For i As Integer = 0 To Values.Count -1 Output.Show(Values(i)) \'获取FTP目录的文件列表 If ftp1.Download(Values(i),"C:\\Data" & Values(i)) = True Then \'此处设置的地址是不是错了. Messagebox.show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Next Next |
-- 作者:有点色 -- 发布时间:2017/3/28 17:45:00 -- Dim ftp1 As New FtpClient Dim fls As List(of String) ftp1.Host="IP地址*****" ftp1.Account = "用户名***" ftp1.Password = "密码***" fls = ftp1.GetFileList("/gaoshengde") For Each fl As String In fls If ftp1.Download(fl,"C:\\Data\\" & FileSys.GetName(fl)) = True Then \'此处设置的地址是不是错了. Messagebox.show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Next ftp1.Close |