WASD Hypertext Services - Environment Overview

[next] [previous] [contents] [full-page]

4 - Directory Listing

A directory listing is sometimes refered to as a document Index, and is generally titled "Index of ...".

Unless disabled by the server's configuration, a directory listing is recognised by the server whenever a wildcard is present in a specification and there is no query string directing another activity (e.g. a document search). Compliant with other hypertext implementations, a directory listing is also generated if a URL specifies a directory only and that directory contains no home page.

All specifications must be made using URL-style paths. See 3.3 - Document Specification.

The directory listing is designed to look very much like the basic layout of other servers, except that all directories are grouped at the top. In the opinion of the author, this looks and functions better than when interspersed with the files, as is otherwise common. The default listing provides:

The description can be either be just that, a description of the role of that type of file under VMS, or if presented within quotes, an HTML document's own internal description taken from the "<TITLE></TITLE>" element.

Note that directory listings only processes the physical file system. This may or may not correspond to the hypertext environment's virtual mappings.

The following link illustrates the directory listing format: *.*


VMS-ish Format

The default listing has a generic WWW look about it, however it can be made to look a little more like the format of the VMS "DIRECTORY" command. In this mode the directories are presented as VMS subdirectories, the version number is shown, if a version wildcard was included in the specification then all matching versions are shown, the size is presented in used and allocated blocks, and automatic script activation is disabled. The VMS-style format is enabled by providing an explicit or wildcard version number with the specification, as in the following example:  *.*;


4.1 - Controlling Access To A Directory

The following files (empty, or not), when within a specific directory regulate access to that directory, and the listing of any parent directory or subdirectories.


4.2 - "Hidden" Files

Any file name beginning with a period is hidden from the directory listing mechanism (i.e. in VMS parlance it has only a type/suffix/extension). If specifically accessed they will be retrieved however. Hence the following files would not appear in a directory listing:


4.3 - Server Directives

The WASD server behaviour can be modified using server directives. For directory listings this involves the inclusion of a query string beginning with "?httpd=index". The server detects this query string and processes it internally, changing the default action of directory listings.

Multiple directives can be combined by concatenating them with intervening ampersands, as per normal URL syntax.

  ?httpd=index&autoscript=no
  ?httpd=index&readme=no
  ?httpd=index&type=text/plain
  ?httpd=index&layout=format
  ?httpd=index&script=script-name
  ?httpd=index&script=script-name&readme=no
  ?httpd=index&delimit=none&readme=no&nos=yes


4.3.1 - Layout

Allows specification of the directory listing layout from the URL, overriding the server default. The layout directive is a short, case-insensitive string that specifies the included fields, relative placement and optionally the width of the fields in a directory listing. Each field is controlled by a single letter (one with colon-separated parameter) and optional leading decimal number specifying its width. When a width is not specified an appropriate default applies. An underscore is used to indicate a single space and is used to separate the fields (two consecutive works well).

The default layout is:

  I__L__R__S__D

The following provide other examples:

  ?httpd=index&layout=UI__L__R__S__D
  ?httpd=index&layout=I__L__R__S:b__D
  ?httpd=index&layout=I__L__R__S__D
  ?httpd=index&layout=I__15L__S__D
  ?httpd=index&layout=15L__9R__S
  ?httpd=index&layout=15N_9C_9R_S

The size of files is displayed by default as 1024 byte kilos. When using the "S:k", "S:m" and "S:f" size modifiers the size is displayed as 1000 byte kilos. If it is prefered to have the default display in 1000 byte kilos then set the directory listing layout using:

  ?httpd=index&layout=I__L__R__S:d__D

If unsure of the kilo value being used check the "<META>" information in the directory listing.

The following links illustrate this functionality by listing this document's directory in a default and then three other formats.

Default.
Only an icon and link.
Icon, link and size (in VMS-style format).
Name, day created and day revised.
Name (in upper-case), day created and day revised.
Description (fixed width) as a link, size in bytes, and day revised.


4.3.2 - Readme Files

When a directory listing is generated any "README.", "README.TXT" or "README.HTML" file (or others as configured for the particular server) in the directory will have its contents displayed immediately below the title of the page. This allows additional information on the directory's contents, function, etc., to be presented. This can be suppressed by appending the following query-string to the directory specification, as in the accompanying example:

  ?httpd=index&readme=no
 
  <A HREF="*.*?httpd=index&readme=no">*.* (no <I>readme</I>s)</A>

Read-me files can be SSI documents if configured by the server administrator. General SSI guidelines apply to these, see 5 - Server Side Includes (SSI)


4.3.3 - Listing Delimiters

A directory listing is normally delimited by a header, comprising an "Index of", column headings and horizontal line, and a footer, comprising a horizintal line. This default behaviour may be modified using the "delimit=" directive.

  ?httpd=index&delimit=none
 
  ?httpd=index&delimit=top


4.3.4 - Suppressing Directories

Parent and subdirectories may be suppressed in a listing using the "nop", "nops" and "nos" directives. These parallel the purpose of the directory listing control files described in 4.1 - Controlling Access To A Directory, and if set to true suppress the listing of the corresponding directories.

  ?httpd=index&nop=yes
 
  ?httpd=index&nops=yes
 
  ?httpd=index&nos=yes


4.3.5 - Listing Refresh and Expiry

Directory listings and trees may be pre-expired. That is, the listing is reloaded each time the page is referenced. This is convenient in some environments where directory contents change frequently, but adds considerable over-head and so is often disabled by default. Individual directory listings may have either default behaviour over-ridden using syntax similar to the following examples:

  /dir1/dir2/*.*?httpd=index?expired=yes
  /dir1/dir2/*.*?httpd=index?expired=no
  /tree/dir1/dir2/?httpd=index?expired=yes
  /tree/dir1/dir2/?httpd=index?expired=no


4.3.6 - Scripting From Directory Listings

When a directory listing is requested a script name can be specified to be used as a prefix to all of the file links in the listing. When the client selects a file link the script specified is implicitly activated.

  ?httpd=index&script=script_name
 
  <A HREF="*.*?httpd=index&script=print">print *.*</A>

The following link illustrates this facility by specifying the (print) script. When a link is selected the print script presents a form to allow the file to be printed:

print *.*


4.3.7 - Auto-Scripting

The server's auto-scripting facility (see 2.1 - Auto-Scripting) can be suppressed by appending the following query-string to the directory specification, as in the accompanying example:

  ?httpd=index&autoscript=no
 
  <A HREF="*.*?httpd=index&autoscript=no">get me *.*</A>

This implies that any file accessed from the listing will be transfered without any data conversion possible due to script activation (see Scripts). The browser must then process the document in some fashion (often by activating a save as dialog).


4.3.8 - Specifying Content-Type

When accessing files it is possible to explicitly specify the identifying content-type to be returned to the browser in the HTTP response header. Of course this does not change the actual content of the file, just the header content-type! This is primarily provided to allow access to plain-text documents that have obscure, non"-standard" or non-configured file extensions. See 3.2 - Explicitly Specifying Content-Type.

It could also be used for other purposes, "forcing" the browser to accept a particular file as a particular content-type. This can be useful if the extension is not configured (as mentioned above) or in the case where the file contains data of a known content-type but with an extension conflicting with an already configured extension specifying data of a different content-type.

It is posssible to "force" the content-type for all files in a particular directory. Enter the path to the directory and then add

  ?httpd=index&type=text/plain

(or what-ever type is desired). Links to files in the listing will contain the appropriate "?httpd=content&type=..." appended as a query string.

This is an example:

  *.*

  *.*?httpd=index&type=text/plain


4.4 - Directory Tree

The "Tree" internal script allows a directory tree to be generated. This script is supplied with a directory name from which it displays all subdirectories in a hierarchical layout, showing subordinancies. Selecting any one of the subdirectories displayed generates a directory listing (see 4 - Directory Listing).

Appending a file specification (with or without wildcards) to the directory name results in the any directory listing displaying only files matching the specification. To display all files a "*.*" should always be appended.

Note that this script only processes the physical file system. This may or may not correspond to the hypertext environment's virtual mappings.

To enable the VMS-style directory listing format, or to use any of the directory server directives, append one, or a combination of, the following query strings to the directory specification:

  ?httpd=index&autoscript=no
  ?httpd=index&readme=no
  ?httpd=index&script=script-name
  ?httpd=index&script=script-name&readme=no

The following links provide online demonstrations:

/ht_root/ tree
/ht_root/ (VMS-ish) tree

Note that this activity is I/O intensive, and can take a considerable period if the tree is extensive.

NOTE

The "tree" internal script supercededs the "Dtree" external script which has been retired.


[next] [previous] [contents] [full-page]