Page MenuHomeDevCentral

html-directories.sh
No OneTemporary

html-directories.sh

#!/bin/sh
# -------------------------------------------------------------
# HTML directories generator
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# Source file: roles/shellserver/userland-software/files/html-directories.sh
# Description: Generates HTML directories listing, similar to nginx autoindex output
# Usage: html-directories [directory]
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
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
Mon, Sep 14, 16:23 (22 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3993907
Default Alt Text
html-directories.sh (1 KB)

Event Timeline