Page MenuHomeDevCentral

html-directories.sh
No OneTemporary

html-directories.sh

#!/bin/sh
#
# Generates HTML directories listing, similar to nginx autoindex output
#
# Usage: html-directories [directory]
DIR=$1
[ -z "$DIR" ] && DIR="."
TITLE="Index of $DIR"
echo "<html>"
echo "<head><title>$TITLE</title></head>"
echo '<body bgcolor="white">'
echo "<h1>$TITLE</h1><hr>"
echo '<pre><a href="../">../</a>'
find $DIR -type d -depth 1 -exec echo "<a href=\"{}\">$(basename "{}")/</a>" \;
echo "</pre><hr></body>"
echo "</html>"

File Metadata

Mime Type
text/x-shellscript
Expires
Fri, Feb 28, 21:45 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435797
Default Alt Text
html-directories.sh (447 B)

Event Timeline