1
我在VBS中编写一个脚本,用于从FTP服务器下载文件并对其进行处理。我有这样一串代码工作正常:VBS ftp下载等待时间
path = evidenceFolder
On Error Resume Next
Const copyType = 16
Set oShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'FTP Wait Time in ms
waitTime = 3000000
strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir & FTPRoute
Set objFTP = oShell.NameSpace(strFTP)
'Download all files in folder
If objFSO.FolderExists(path) Then
'Entire folder
Set objFolder = oShell.NameSpace(path)
objFolder.CopyHere objFTP.Items, copyType
End If
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Description & " - " & Err.Number
End If
'Wait for upload
Wscript.Sleep waitTime
如果我不设置文件的适当等待时间的处理开始之前下载完成。由于我必须下载大文件,我需要为等待时间设置一个很高的值。如果下载量不是很大,它会一直等待很长时间。
有没有一种方法只是等待下载完成,而不是一个任意的和恒定的时间?
谢谢