Retrieve ftp file contents

H

Hoof Hearted

I need my application to read the contents of a text file located on an ftp
server. I had hoped that I could use the 'Open' keyword to do this:

MyURL = "ftp://weather.noaa.gov/data/EGNH.TXT"
Open MyUrl for input as 1

I get the error 'Bad File name or number'

How can I do this?
 
H

Hoof Hearted

Alex,

I couldn't make your solution work. I'm behind an ISA firewall. So perhaps
that had something to do with it. However, I've got a solution that nearly
works....

FilePath = "C:\data\databases\temp\EGNH.TXT"

MyUrl = "ftp://weather.noaa.gov/data/observations/metar/stations/EGNH.TXT"

Set XML = CreateObject("Microsoft.XMLHTTP")
XML.Open "GET", MyUrl, False
XML.Send

MyStream.Type = adTypeBinary
MyStream.Open
MyStream.Write XML.responseBody

MyStream.SaveToFile FilePath, adSaveCreateOverWrite

MyStream.Close

Set MyStream = Nothing
Set XML = Nothing

The only problem with this is that it retrieves locally cached copies of the
file. I only get the current version if I browse to the ftp site in IE and do
a refresh, then run the above code.

How can I force the above code to ignore the cache?
 
A

Alex Dybenko

The only problem with this is that it retrieves locally cached copies of
the
file. I only get the current version if I browse to the ftp site in IE and
do
a refresh, then run the above code.

How can I force the above code to ignore the cache?

Well, this i dont know, probably your ISA server caches this page?
 
H

Hoof Hearted

Perhaps ISA is caching the file, it just seems strange that when I do a
refresh in IE, my code also gets the newest version next time I run it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top