#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); ######################## $path="/home/foo/www/dir"; $location="http://mysite.com/dir"; print "Content-type: text/html\n\n"; ######################## &Begin; sub top { opendir(DIR, "$path" ); @thefiles = sort(grep(/html$/, readdir(DIR))); $count = 0; foreach $_ ( sort @thefiles) { $count++; } closedir(DIR); print ""; print "MY SIMPLE FILE SELECTOR"; print ""; print "

MY SIMPLE FILE SELECTOR

"; print "

The following [$count] files were found in the [$path] Dir.

"; print "
"; } sub Begin { ⊤ print "
"; print ""; print "
"; print "
"; print "
  • Select files
    "; foreach $_(@thefiles) { $file_pathname = "$location" . "/" . "$_"; if (-e $file_pathname) {next;} $_ = "$FORM{'file'}"; print "     $_
    "; } print "

    "; print "
  • "; print "
    "; print "
    Go Back..."; ⊥ } sub bottom { print "

    "; print "$footer"; print ""; exit; } sub create_list { open(FILE, ">list.txt"); foreach $_ (@thefiles) { if ($_ == 1) { print FILE "$_\n"; } } close(FILE); &finished; } sub finished { print "

    Finished...

    "; print "You selected $_
    "; }