I have a script that downloads some text files from a site. I have it scheduled to run automatically every hour. The problem is sometimes it succeeds, sometimes it fails, but there is no pattern of when it fails. The failure happens at the line MySite.connect. Following is the code (I tried with both FTP and SFTP).
Please help! Thanks!
Please help! Thanks!
Code:
Set MySite= CreateObject("CuteFTPPro.TEConnection")
MySite.Option ("ThrowError") = True
MySite.Host = "sftp://login:pwd@some.site/"
objShell.LogEvent EVENT_SUCCESS,"host set"
MySite.Connect
objShell.LogEvent EVENT_SUCCESS, "connected to host"
If (Not Cbool(MySite.IsConnected)) Then
objShell.LogEvent EVENT_SUCCESS, "connect failed!"
MsgBox "Could not connect to: " & MySite.Host & "!"
Set MySite = nothing
Quit(1)
End If
MySite.LocalFolder = "F:\txtImports"
myPath = "/data/export/" & myDate & myHour & "*"
MySite.Download myPath
objShell.LogEvent EVENT_SUCCESS, "downloaded"
MySite.Disconnect
MySite.Close
Set MySite = nothing