Arkanic

Generating a HTML folder index

I'm trying out this new system that I made for hosting simple notes/observances/whatever that other people might be interested in on this site.

I modified a shell script for this purpose, and here it is:

#!/bin/bash ROOT=./site/notes/ HTTP="/" OUTPUT="./site/notes/index.html" i=0 echo "<!DOCTYPE html><html><head><title>Notes Index</title></head><body><ul>" > $OUTPUT for filepath in `find "$ROOT" -maxdepth 1 -mindepth 1 -type d| sort`; do path=`basename "$filepath"` formattedpath="${path//-/ }" echo " <li><a href=\"./$path/\">$formattedpath</a></li>" >> $OUTPUT done echo "</ul></body></html>" >> $OUTPUT

Variables within the script:

ROOT is the path to the folder you want indexed.

OUTPUT is the resultant folder.

Comment Form is loading comments...