Is it possible to download a file in intervals from a specified URL to a specified location in an easy way?
I created VBScript:
Set args = WScript.Arguments
path = ""
datePath = ""
Url = ""
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Do
If filesys.FileExists(path) Then
filesys.DeleteFile path
End If
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", Url, False
xHttp.Send
with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile path, 2 '//overwrite
end with
If(xHttp.Status = 200) Then
If filesys.FileExists(datePath) Then
filesys.DeleteFile datePath
End If
Set dateFile = filesys.CreateTextFile(datePath)
dateFile.WriteLine(FormatDateTime(Now))
dateFile.close()
End If
WScript.Sleep 600000
Loop
But it doesn't work as it returns following prompt:
This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?
I tried to disable notification by changing internet options but it also doesn't work for me. I need the script to work even when I am absence in my job thus I need to improve/change this to be maintenance-free. It also needs to work on Windows OS.
I also tried to use powershell > wget but then authentication problem occures as file i need to get is in secured business's infranet and need to use my login credentials I tried to provide them in URL or as wget arguments --user/-password - It doesn't work because login procedure requires redirections. VBScript uses my current session thus infranet security system allows it to get in.
Is anyone able to help with my problem?