#!/bin/sh # # generate_index_html # # Generates index.html files with a link to each file in the directory, and # recursively for its sub-directories. # # Note: This script recursively calls itself, so it had better be in its # own path! # INDEX=index.html.$HOST trap 'rm -f $INDEX; exit 1' 1 2 3 13 15 # # These are the standard locations for apache's icons # img_txt="" img_dir="" img_bak="" echo "

Directory listing

" > $INDEX echo "
" >> $INDEX echo "$img_bak Parent Directory
" >> $INDEX for file in * do if [ $file != index.html ] && [ $file != README ] then if [ -d $file ] then (cd $file && generate_index_html) echo "$img_dir $file/
" >> $INDEX else size=`ls -l $file | awk '{ print $5; }'` sizekb=`expr $size / 1024` echo "$img_txt $file ($sizekb kilobytes)
" >> $INDEX fi fi done echo "
" >> $INDEX if [ -f README ] then echo "
" >> $INDEX
    cat README >> $INDEX
    echo "
" >> $INDEX fi chmod a+r,g+w $INDEX chgrp mercury $INDEX mv $INDEX index.html