#! /bin/sh # simplemachines.it's web server doesn't provide directory indices # so we do it with this script # # Usage: mkindex dirname # where dirname is a path to the directory in which to create index.html # # Martin Guy March 2008. for dirname do { echo "Index of $dirname" echo "" echo "

Index of $dirname


" echo "
"
	# LANG=C: Sort in ASCII order (capitals first), not dictionary order
	LANG=C ls -la "$dirname" | tail -n +3 |
		grep -v ' index.html$' |
		sed 's|\(.*\) \([^ ]*\)|\1 \2|'
	echo "

Index generated by mkindex `date`" echo "" } > $dirname/index.html done