mkindex.sh

 

###
### mkindex.sh
###
### Recurse through subdirectories, finding HTML
### Create index.html page from results
###
###
###

x=`pwd`
TITLE=`basename $x`

echo "<html> " > index.html
echo "<head> " >> index.html
echo "   <title> $TITLE </title> " >> index.html
echo "   <META content=text/css http-equiv=Content-Style-Type>" >> index.html
echo "   <LINK href=\"http://www.setgetweb.com/white.css\" rel=\"stylesheet\" type=\"text/css\">" >> index.html
echo "</head> " >> index.html
echo "<body> " >> index.html
echo " " >> index.html
echo "<blockquote> " >> index.html
echo "<blockquote> " >> index.html
echo "<font class=grey2>" >> index.html
echo " " >> index.html
echo "<p>&nbsp;</p> " >> index.html
echo "<center> " >> index.html
echo "<h1> $TITLE </h1> " >> index.html
echo "</center> " >> index.html
echo "<p>&nbsp;</p> " >> index.html
echo " " >> index.html
echo "<p><hr> " >> index.html
echo "<p><ol> " >> index.html


xtitle=""
a="xyz"

### Recursive
#for i in `find . -name \*.htm\* -print | \
#          grep -v \.\/index.html | \
#          grep -v html.html | \
#          grep -v \.gif | \
#          grep -v template.html | \
#          grep -v tmp`

for i in `ls -1 *.htm* | grep -v index.htm | grep -v html.html | grep -v \.gif | grep -v template.html | grep -v tmp`
do
   xtitle=`grep -i "<title" $i | \
   sed "s/<title>//g" | \
   sed "s/<\/title>//g" | \
   sed "s/<TITLE>//g" | \
   sed "s/<\/TITLE>//g" | \
   sed "s/<head>//g" | \
   sed "s/<\/head>//g" | \
   sed "s/<HEAD>//g" | \
   sed "s/<\/HEAD>//g"`

    x=`dirname $i`
    y=`basename $i`
    z=`basename $i .html`
    q=`echo $x | sed "s/\// /g"`
    echo $z

    if [ "$x" = "$a" ]
    then
         echo "<li><a href=\"$x/$y\">$xtitle</a> " >> index.html
    else
         #echo "<p><b>$q</b> " >> index.html
         echo "<p><li><a href=\"$x/$y\">$xtitle</a> " >> index.html
         a=$x
    fi

    
done

echo " <p></ol> " >> index.html
echo " <p><hr> " >> index.html
echo "  " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <a href=\"http://www.setgetweb.com/index.php\"><img border=0 src=\"http://www.setgetweb.com/home.gif\" align=left alt=\"Home\"></a> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo " <p>&nbsp;</p> " >> index.html
echo "  " >> index.html
echo " </blockquote> " >> index.html
echo " </blockquote> " >> index.html
echo "  " >> index.html
echo " <center> " >> index.html
echo " <script javascript=\"JavaScript\"> " >> index.html
echo "     document.write(\"<br>Last updated: \"+document.lastModified); " >> index.html
echo " </script> " >> index.html
echo "  " >> index.html
echo "  " >> index.html
echo " </center> " >> index.html
echo "  " >> index.html
echo "    </body> " >> index.html
echo " </html> " >> index.html