以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  ftp.Download批量下载时的BUG?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131102)

--  作者:jnletao
--  发布时间:2019/2/16 15:55:00
--  ftp.Download批量下载时的BUG?
写了一个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


--  作者:有点蓝
--  发布时间:2019/2/16 17:43:00
--  
我测试没有问题。

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