#!/usr/bin/perl ############################################################################ # Last revision: 01.04.1999 # ########################## DESCRIPTION ################################### # A HTML index maker for some directory. # .... obvious it creates a file named 'index.html' in the directory # specified containing a list with all the files therein. # # ... launch it without any arguments to see the usage. # ############################################################################ ############################################################################ # Copyright 1999 by AltBlue [IRL: Marius Feraru] # # All rights reserved # # # # Distribute freely, except: # # * don't remove my name from the source or documentation # # (don't take credit for my work) # # * mark your changes # # (don't get me blamed for your possible bugs) # # * don't alter or remove this notice. # # # # May be sold if buildable source is provided to buyer. # # No warrantee of any kind, express or implied, is included with this sw. # # Use at your own risk, responsibility for damages (if any) to anyone # # resulting from the use of this software rests entirely with the user. # # # # Send bug reports, bug fixes, enhancements, requests, flames etc., and # # I'll try to keep a version up to date. # # # # I can be reached as follows: # # E-Mail: AltBlue # # Homepage: http://www.cs.tuiasi.ro/altblue/ # ############################################################################ $version = '0.1'; verbose("HTML Indexer v.$version by AltBlue \n"); unless($ARGV[0] && -d $ARGV[0] && -W $ARGV[0]) { print < [-v] USAGE exit 1; } $verbose = $ARGV[1] eq '-v' ? 1 : 0; $dir = $ARGV[0]; $index = "$dir/index.html"; die "$index already exists! Bailing out.\n" if -f $index; push(@HTML,"Index of $dir\n

Index of $dir


    \n"); opendir(DIR, $dir) && verbose("'$dir' succesfully opened. Processing...\n") || die "ERROR: Couldn't open $dir : $!\n"; foreach (readdir(DIR)) { next if $_ eq '.' || $_ eq '..'; verbose("Added $_\n"); push(@HTML,"\t
  • $_\n"); } closedir(DIR); push(@HTML,"


\n"); push(@HTML,"

This page was produced by a web utility engineered by AltBlue <altblue\@tuiasi.ro>

\n"); push(@HTML,"\n"); verbose("addition completed. writing index file...\n"); open(INDEX,">$index") || die "ERROR: couldn't open index file: $!\n"; print INDEX @HTML; close(INDEX); verbose("Job done.\n"); sub verbose { print @_ if $verbose; }