#!/usr/bin/perl #------------------------------------------------------------------# # PROGRAM: dirindex.pl # # # # PURPOSE: Generate an "index.html" file by reading all of the # # other .html files in the current directory. # # # # USAGE: # # Unix: # # dirindex.pl > index.html # # DOS: # # perl dirindex.pl > index.html # # # # DISCUSSION: # # # # This is a very simple, but helpful, utility that can # # be used to build an "index.html" page from other # # HTML files already in the current directory. # # # # For example, suppose you have a directory with 100 # # files, named "1.html" through "100.html". If you want # # to build an index.html page with a bulleted list of all # # files in this directory, just run the program like this: # # # # dirindex.pl > index.html # # # # Of course, if you're on a DOS/Windows system you'll # # want to run it like this instead: # # # # perl dirindex.pl > index.html # # # # This program reads the list of HTML files in the current # # directory, and generates a simple, page for you # # automatically. # # # #------------------------------------------------------------------# # # # COPYRIGHT NOTICE: # # # # Copyright 1998 DevDaily Interactive, Inc. All Rights Reserved. # # # # This program is distributed free of charge. It may be used # # and modified free of charge so long as this copyright notice # # remains intact. By using this program you agree to indemnify # # DevDaily Interactive from any liability. # # # # Selling the code for this program without prior written # # consent is expressly forbidden. # #------------------------------------------------------------------# #---------------------------------------------------------------# # Open the current directory, and create a list of HTML files # # in the directory. # #---------------------------------------------------------------# opendir(DIR, "."); @htmlFiles = grep(/\.html$/,readdir(DIR)); closedir(DIR); #--------------------------------------------------------------# # Print the HTML index file contents (index.html) to STDOUT. # # This gives you the chance to name the file something else # # when re-directing the output (i.e., "> myfile.html"). # #--------------------------------------------------------------# print "\n"; print "\n"; print "\n"; print "\n"; print "\n";