rp_html_directory_listing

one of the documented procedures in this installation of the ACS
Usage:
rp_html_directory_listing   dir
What it does:
Generates an HTML-formatted listing of a directory. This is mostly stolen from _ns_dirlist in an AOLserver module (fastpath.tcl).
Defined in: /web/philip/packages/acs-core/request-processor-procs.tcl

Source code:


    # Create the table header.
    set list "
<table>
<tr align=left><th>File</th><th>Size</th><th>Date</th></tr>
<tr align=left><td colspan=3><a href=../>..</a></td></tr>
"

    # Loop through the files, adding a row to the table for each.
    foreach file [lsort [glob -nocomplain $dir/*]] {
	set tail [file tail $file]
	set link "<a href=$tail>$tail</a>"

	# Build the stat array containing information about the file.
	file stat $file stat
	set size [expr $stat(size) / 1000 + 1]K
	set mtime $stat(mtime)
	set time [clock format $mtime -format "%d-%h-%Y %H:%M"]

	# Write out the row.
	append list "<tr align=left><td>$link</td><td>$size</td><td>$time</td></tr>\n"
    }
    append list "</table>"
    return $list


philg@mit.edu