Iterating and downloading a URL that lists files?

J

Jim Bancroft

Is there a way to open a URL, one that shows nothing other than a directory
listing, and iteratively go through the list to download the files?
 
G

Guest

Is there a way to open a URL, one that shows nothing other than a directory
listing, and iteratively go through the list to download the files?

Hi Jim,

you can use a HttpWebRequest with a StreamReader to get the page from
the URL, then the content of the page can be parsed with a regular
expression to get the list of all links and then again use
HttpWebRequest to get the files...

Hope it helps
 
L

Laurent Bugnion, MVP

Hi,

Alexey said:
Hi Jim,

you can use a HttpWebRequest with a StreamReader to get the page from
the URL, then the content of the page can be parsed with a regular
expression to get the list of all links and then again use
HttpWebRequest to get the files...

Hope it helps

I did that a long time ago with a Java applet. I then discovered that
the page format was different in Netscape (back then) and IE. I hope
things are more standard now!

HTH,
Laurent
 
G

Guest

the page format was different in Netscape (back then) and IE. I hope
things are more standard now!

Laurent, do you mean that the default directory listing depends on the
client browser? It depends on a web server and not on a browser. I
have no example for IIS, but here's the one for Apache

Default settings:
http://tomcat.apache.org/tomcat-6.0-doc/default-servlet.html

Example how it looks on the website:
http://cohred.org/cohred/content/

When directory browsing in enabled on a web site and there isn't a
default document available, IIS will display the contents of the
directory as a similar page and it looks the same in IE, and other
browsers
 
L

Laurent Bugnion, MVP

Hi,

Alexey said:
Laurent, do you mean that the default directory listing depends on the
client browser? It depends on a web server and not on a browser. I
have no example for IIS, but here's the one for Apache

Back then, the client browser used to add content to the directory
listing page. I tested again right now in Firefox and IE, and apparently
this is not the case anymore, so you're lucky!

I am talking about Netspace 4 and IE4, that was back in... not sure...
97 maybe?

Anyway, good luck with your project!
Laurent
 

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

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top