Foxtable(狐表)用户栏目专家坐堂 → ftp.Download批量下载时的BUG?


  共有2467人关注过本帖树形打印复制链接

主题:ftp.Download批量下载时的BUG?

帅哥哟,离线,有人找我吗?
jnletao
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:936 积分:7719 威望:0 精华:0 注册:2013/7/7 13:37:00
ftp.Download批量下载时的BUG?  发帖心情 Post By:2019/2/16 15:55:00 [只看该作者]

写了一个FTP批量更新函数,发现只要 ftp.Download(sourceFile, destinationFile, ShowUI)最后一个参数设为false,就只能下载一个文件,而且很慢!而设为ture,弹出进度条方式,就下载很快,并可以批量持续,请问是什么原因?
如何解决?
以下内容为程序代码:

1 Dim ftp As New FTPClient
2 ftp.host = vars("FTP_ip地址")
3 ftp.Account = vars("FTP_账号")
4 ftp.password = vars("FTP_密码")
5 ftp.Port = vars("FTP_端口")
6
7 Functions.AsyncExecute("文件刷新","",ftp)



以下内容为程序代码:

1 Dim dls As List(of String)
2 'ftp 以变量2方式代入,避免重复连接
3 'Dim ftp As New FTPClient
4 'ftp.host = vars("FTP_ip地址")
5 'ftp.Account = vars("FTP_账号")
6 'ftp.password = vars("FTP_密码")
7 'ftp.Port = vars("FTP_端口")
8 dls = args(1).GetDetailList(args(0))
9 Dim locfile As String
10 Dim ftpfile As String
11 Dim locpath As String = ProjectPath & "RemoteFiles\"
12 For Each dl As String In dls
13 If dl.Split("*")(2) = "D" Then
14 'Output.Show(args(0) & "/" & dl.Split("*")(0))
15 Functions.Execute("文件刷新", args(0) & "/" & dl.Split("*")(0),args(1))
16 Else
17 'Output.Show(dl)
18 locfile = locpath & args(0) & "\" & dl.Split("*")(0)
19 locfile = locfile.Replace("/","\")
20 locfile = locfile.Replace("\\","\")
21 ftpfile = args(0) & "/" & dl.Split("*")(0)
22 If FileSys.FileExists(locfile) = False Then
23 'Output.Show(locfile)
24 ' Output.Show(ftpfile)
25 args(1).Download(ftpfile,locfile,True)
26 Else
27 Dim info As new FileInfo(locfile)
28 Dim ftpdate As Date = dl.Split("*")(1)
29 If info.LastWriteTime < ftpdate Then '如果ftp上的文件更新则下载
30 'Output.Show(ftpfile)
31 args(1).Download(ftpfile,locfile,True)
32 End If
33 End If
34 End If
35 'Output.Show()
36 Next


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107135 积分:544918 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/2/16 17:43:00 [只看该作者]

我测试没有问题。

另外请不要使用插入代码的方式上传代码,别人没法测试使用

 回到顶部