#!/bin/sh
# Author : Mongoose <stu7440@westga.edu>
# Comment: A script for file listing via web page
#          for servers that don't generate them

echo "<HTML>" > index.html
echo "<HEAD>" >> index.html
echo "  <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">" >> index.html
echo "   <meta name=\"keywords\" content=\"Mindless garbage\">" >> index.html
echo "   <meta name=\"editor\" content=\"XEmacs 21.1\">" >> index.html
echo "</HEAD>" >> index.html

echo "<TITLE>File listing: Generated by listing.sh 0.0.3 by Mongoose</TITLE>" >> index.html

echo "<BODY bgcolor=\"#6C6C80\" text=\"#FFFFFF\" " >> index.html
echo "      link=\"#dfdfdf\" vlink=\"#cfcfcf\" alink=\"#cfcfcf\">" >> index.html

echo "<TABLE>" >> index.html
echo "<TR><TD><a href=\"..\">Parent Dir</a><br></TD><TD> </TD></TR>" >> index.html
echo "<TR><TD><B><U>Filename</U></B></TD><TD>&nbsp;&nbsp;&nbsp; <B><U>Size</U></B></TD></TR>" >> index.html

#for x in `ls` 
for x in *
do
#	if [ ! -f $x ]; then
#		continue
#	fi

	if [ "${x}" = "index.html" ]; then
		continue
	fi

echo "<TR><TD>"  >> index.html
echo -n "<a href=\"" >> index.html
echo -n "$x" >> index.html
echo -n "\">$x</a>  " >> index.html
echo "</TD><TD>"  >> index.html
echo "&nbsp;&nbsp;&nbsp; `ls -h -s "$x" | sed -e \"s/$x//\"`<br>" >> index.html
echo "</TD><TR>"  >> index.html

done

echo "</TABLE>" >> index.html

echo "<br><br>Generated by listing.sh 0.0.3<br>" >> index.html
echo "by Mongoose" >> index.html
echo "</BODY></HTML>" >> index.html

