On Wed, 19 Feb 2003, Scott, Deborah wrote:

> Does anyone know where I can get a script that looks into the contents of a
> directory and outputs the contents of the directory into a list that is
> displayed on an HTML page? (Also, the names should contain hyperlinks to
> those contents.)

Deborah,
   If your webserver is apache, then it can easily be set up to do this 
without writing any code. In fact, mine did it with the default 
configuration. If the directory has no index.html file in it, it will list 
the contents of the directory.
   However, if this doesn't suit your needs, here's a little script I just 
wrote to do what you need.

#!/usr/bin/perl

use strict;
use CGI qw(:standard);

my $home='/var/www/html';
my $dir='pictures';

print header;
print start_html;
foreach (glob("$home/$dir/*")) {
    $_=~s#$home/$dir/##;
    print "<A HREF='/$dir/$_'>$_</A><BR>\n";
}
print end_html;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to