Script to auto-download file from FTP site

Results 1 to 2 of 2

Thread: Script to auto-download file from FTP site

  1. #1
    Join Date
    Dec 1969

    Default Script to auto-download file from FTP site

    I&#039;ve been trying for the past couple days to get a script working that will download a 7 mb datafeed (txt file). The code below works perfectly for smaller files that I&#039;ve tried (6 kb) but I get an error when I try to download the larger files through the script. My eventual goal is to automate the downloading, and the loading of the datafeed into my database a couple times a week so I don&#039;t have to be bothered with it.<BR><BR>Response.Buffer = True<BR>Server.ScriptTimeout = 3600<BR>Set xml = Server.CreateObject("MSXML2.XMLHTTP")<BR>xml.Open "GET", "ftp://username:password@ip.address/feed.txt", false<BR>xml.Send()<BR>If err.Number &#060;&#062; 0 then<BR>xml.abort()<BR>Set xml = Nothing<BR>Else<BR>fl1 = xml.responseText<BR>Set xml = Nothing<BR>Set fs = Server.CreateObject("Scripting.FileSystemObject")< BR>Set fl = fs.CreateTextFile("C:Pathfeed.txt",True,False) <BR>fl.WriteLine fl1<BR>fl.Close<BR>Set fl = Nothing<BR>Set fs = Nothing<BR>End If<BR><BR>The error I get when this is executed is (BTW, it&#039;s actually loading the 7 MB file before the error):<BR><BR>Microsoft VBScript runtime error &#039;800a0005&#039; <BR>Invalid procedure call or argument <BR>/tdftp.asp, line 18 <BR><BR>Line 18 is: fl.WriteLine fl1<BR><BR>If I change the last parameter of line 17 to True (to save the file as unicode instead of ASCII) it saves it with no error, but the output in the file is unreadable, ex: ÿþ atrldpo&#124cttpalraanec aam sezc kaa 4nihr Pmf <BR><BR>If anybody has a solution to fix this script so it will work with the larger files I would appreciate it, also any better solutions for downloading the datafeeds from a FTP site, I would appreciate hearing about them as well. <BR> <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Script to auto-download file from FTP site

    i wanted to implement a similar functionality and i did that through a batchfile which first downloads the txt file through ftp and then opens a macro in Access. this macro imports data from the txtfiles into the MS Access tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts