mod_dirlist

mod_dirlist lists files inside a directory. The output can be customized in various ways from style via css to excluding certain entries.

dirlist (action)

lists file in a directory

dirlist options;
options
A key-value table with the following entries:
css
string: url to external stylesheet (default: inline internal css)
hide-dotfiles
boolean: hide entries beginning with a dot (default: true)
hide-tildefiles
boolean: hide entries ending with a tilde (~), often used for backups (default: true)
hide-directories
boolean: hide directories from the directory listing (default: false)
include-header
boolean: include HEADER.txt above the directory listing (default: false)
hide-header
boolean: hide HEADER.txt from the directory listing (default: false)
encode-header
boolean: html-encode HEADER.txt (if included), set to false if it contains real HTML (default: true)
include-readme
boolean: include README.txt below the directory listing (default: true)
hide-readme
boolean: hide README.txt from the directory listing (default: false)
encode-readme
boolean: html-encode README.txt (if included), set to false if it contains real HTML (default: true)
exclude-suffix
list of strings: hide entries that end with one of the strings supplied (default: empty list)
exclude-prefix
list of strings: hide entries that begin with one of the strings supplied (default: empty list)
debug
boolean: output debug information to log (default: false)
content-type
string: content-type to return in HTTP response headers (default: "text/html; charset=utf-8")

Example

shows a directory listing including the content of HEADER.txt above the list and hiding itself from it; also hides all files ending in “.bak”

setup {
	module_load ("mod_dirlist");
}

if req.path =^ "/files/" {
	dirlist ("include-header" => true, "hide-header" => true, "hide->suffix" => (".bak"));
}