Get file list over http

R

Rohit

Hi, I am trying to write a script, which downloads files over http. I
am using curl command to download the file, but using curl I have to
pass filename. Filename on server would be changing frequently, so is
there any way to get list of files over http? Once I get filename,
then I can pass that filename to curl and download the file.

I would also be thankful, if you can suggest any other way to achieve
this task.

If I have posted this message in wrong group, please rout me to
correct group.

I would appreciate your reply. Thanks in advance.

Thanks,
Rohit
 
R

Rohit

Rohitwrote:


To 'get a list of files over http' usually means to retrieve
the index of a directory. Depending on the configuration of
the server, this may be allowed/provided or not. If the browser
displays an explorer-like view when accessing a URL ending with
a directory name, it serves back a html page with a list of
links to each file.

To retrieve this index page, you can use the LWP::Simple module.
To extract links from the page, HTML::LinkExtor or HTML::TreeBuilder
can aid you. If you have successfully extracted the links (all
modules come with a number of examples) you can once again
use LWP::Simple and retrieve the files directly to disk with its
getstore() method.

HTH
-Chris

Thanks Chris, It works great.
 

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
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top