Please help me, I simply have to download a bunch of logfiles from a REMOTE WebSite in txt format when i launch a script. I use this code...
<%
ciclo=0
cicli=enddate1-startdate1+1
'Response.Write "<br>"
'Response.Write cicli
FileName = filtro + ".txt"
For ciclo = 0 to cicli
strYear = Mid(startdate1, 7)
strMonth = Mid(startdate1, 4, 2)
strDay = Left(startdate1, 2)
stringa = (strYear & strMonth & strDay)
fileURL = "
http://xxx.xxx.xxx/logs/" & stringa & ".txt"
hdFileName = hdLocation+stringa+FileName
Response.Buffer = True
Set xmlHTTP = Server.CreateObject("Microsoft.XMLHTTP")
xmlHTTP.open "GET", fileURL, False
xmlHTTP.Send ""
Response.Flush
set myStream = CreateObject("ADODB.Stream")
myStream.Open
myStream.Type = 1
myStream.Write xmlHTTP.ResponseBody
myStream.Position = 0 'Posizione iniziale di stream
set FSO = Createobject("Scripting.FileSystemObject")
if fso.Fileexists(hdFileName) then Fso.DeleteFile hdFileName
set FSO = Nothing
myStream.SaveToFile hdFileName
myStream.Close
Set myStream = Nothing
Set xmlHTTP = Nothing
startdate1=startdate1+1
Response.Write "<br>"
Response.Write startdate1
next
Response.Flush
%>
...everything works fine but there is a simpler method to do it or to copy txt files from a remote webserver to local disk?
Edited by barnum64 - 19 March 2005 at 1:41pm