1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/sh set -eu cd "$1" ( echo "<tt>" (echo ".."; ls) | while read file; do [ "$file" = "index.html" ] && continue if test -d $file; then stat -c '%.10y <a href="%n/index.html">%n/</a> <br />' $file else stat -c '%.10y <a href="%n">%n</a> %s Bytes <br />' $file fi done echo "</tt>" ) > index.html