One day it became needed for me to generate the most simple index one could find to index some JPG and MOV files (yes capitals), therefor i wrote the below script (really easy). You can use it with the BSD License ofcourse.

 

#!/usr/bin/perl T

use CGI;
use warnings;
use diagnostics;
use strict;

my $CGI = new CGI;
my $file;
my $URI = "http://yourdomain/yoururl";
my $path = "/local/path/to/your/images/and/movies";
my $title = "The title of the generated index file";

opendir(DIR, $path);
my @files = grep { /\.JPG|.MOV$/ } readdir(DIR);
closedir(DIR);

print $CGI->header();
  print $CGI->start_html("$title");
    print $CGI->p({-align=>"center"}, "$title");
    print "<table width=’100%’>";
      foreach $file (@files) {
        print "<tr>";
          print "<td align=’center’>";
            print $CGI->a({href=>"$URI/$file"},"$file");
          print "</td>";
        print "</tr>";
      }
    print "</table>";
  print $CGI->end_html();

Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>