[WEB4LIB] Automating a Directory Listing in a Web Page

Thomas Dowling tdowling at ohiolink.edu
Mon Nov 22 08:21:53 EST 1999


> Here's what I want to to:
>
> Directory on a web server with a bunch of WordPerfect file.
> I want to generate an index.html file that would read the directory,
print
> the directory listing and automatically hyperlink those filenames to the
> actual WP files.
>

Michael--

This sounds like the default behavior for any good web server when its
default index file is not present (that is, when there is no index.html).
Am I missing something?

If you really need to handle this outside the web server's own
functionality, it's very common in Perl to do an opendir on a directory
and then "while ($file = (readdir DIR_HANDLE)) {..." and process each file
name as needed.  You could either set up an index.cgi script to do this on
the fly or have some batch process that writes it out to index.html.
Either way, though, you're reinventing a wheel your server already has.

Thomas Dowling
OhioLINK - Ohio Library and Information Network
tdowling at ohiolink.edu




More information about the Web4lib mailing list