Zucca
Group: Members
Posts: 524
Joined: Feb. 2006 |
|
Posted: Dec. 17 2006,20:41 |
|
Update:
Code Sample | #!/bin/bash
VERS="v0.2.2.2b"
LICENCE=" # mkindexhtml.sh - Creates index.html file containing links to files it finds. # handy with nweb httpd. http://www-128.ibm.com/developerworks/eserver/library/es-nweb.html # Copyright (C) 2006 Zucca (Zucca@IRCnet, ICQ#: 66768853, Zucca@dive.to)
# This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # http://www.gnu.org/licenses/gpl.txt " # NEW feature: # if you place .index.header or .index.footer files # to the same dir where mkindexhtml.sh will create it's # index.html then it will incluce those files in index.html. # Header will be displayed before filelisting and # footer will be displayed arfer.
HTMLSOURCEFOOTER=" As you seemed enough curious to look for html source, here's some details about mkindexhtml.sh:
Licence: $LICENCE
In a simple way: It's free. Some versions I make are not posted to public. - Why? Because I want to publish only good versions of this program. Anyway you can still contact me if you want your copy of mkindexhtml.sh.
Currently I publish mkindexhtml.sh only at Damn Small Linux board: http:///damnsmalllinux.org/static/act-ST/f-23/t-16279"/
if [ "$1" == "--help" ] then echo -e "USAGE: mkindexhtml.sh <dir> <column count> [noprompt]" echo -e " mkindexhtml.sh --help\n" echo -e "mkindexhtml.sh creates a file named index.html to <dir>." echo -e "index.html will contain all visible files (except index.html, nweb.log and directories) with links to them" echo -e "<column count> determines maxium of \$FILEs on a single line." echo -e "\nUseful with nweb httpd. http://www-128.ibm.com/developerworks/eserver/library/es-nweb.html" echo -e "\n mkindexhtml.sh $VERS (C) (GPL) Zucca@IRCnet, ICQ#:66768853\n" exit 0 fi
if [ -z $2 ] then echo -e "USAGE: mkindexhtml.sh <dir> <column count> [noprompt]" echo -e " mkindexhtml.sh --help\n" exit 1 fi
if [ -f "$1/index.html" ] && [ "$3" != "noprompt" ] then echo "You already have previous index.html." rm -i $1/index.html if [ -f "$1/index.html" ] then echo -e "Aborted. Left original index.html untouched." exit 1 fi elif [ -f "$1/index.html" ] && [ "$3" == "noprompt" ] then rm -f $1/index.html fi
let "COLC=1"
echo -ne "<HTML>\n\n<HEAD>\n<TITLE>Directory index created by mkindexhtml.sh</TITLE>\n</HEAD>\n\n<BODY>\n" >> $1/index.html
if [ -f "$1/.index.header" ] then cat $1/.index.header >> $1/index.html fi
echo -ne "\n<NOBR>\n" >> $1/index.html
for FILE in `ls $1` do
if [ "$FILE" != "index.html" ] && [ "$FILE" != "nweb.log" ] && [ ! -d "$FILE" ] then
echo -ne "<A HREF=\"$FILE\">$FILE</A>\n" >> $1/index.html if [ ! "$COLC" -eq "$2" ] then echo -n "| " >> $1/index.html fi
let "COLC=$COLC+1"
if [ "$COLC" -gt "$2" ] then echo "<BR>" >> $1/index.html let "COLC=1" fi fi done
UDATE=`date`
if [ -f "$1/.index.footer" ] then cat $1/.index.footer >> $1/index.html fi
echo -ne " </NOBR><PRE>Index updated: $UDATE mkindexhtml.sh $VERS created by Zucca@IRCnet, ICQ#:66768853 Licenced under GNU General Public License.</PRE>
</BODY>" >> $1/index.html
echo -ne "\n\n<!--\n$HTMLSOURCEFOOTER\n\n//-->\n\n</HTML>" >> $1/index.html |
-------------- Do you have it? - http://dy.fi/mak
|