The Apache module mod_autoindex generates "directory indexes" that show users a crude hyperlinked list of the files and directories inside a directory (when there is no index.html or other DirectoryIndex file).

I have a directory on an Apache webserver where I want to provide an automatic directory listing, including the full filenames, sorted most-recently-modified-first, with file sizes displayed, using simple and attractive presentation. I cannot use mod_autoindex or other Apache features.

I am therefore looking for a simple script that does much the same thing as mod_autoindex. In other words I want a script I can put in a directory that outputs an HTML document to STDOUT that contains a hyperlinked list of the files in the directory.

The script should present its output in a simple & attractive way (non-technical people will be using it), consist of one file that I can edit if required, and preferably be OS-independent (so I can use it again later). Extra features would be great, but ease of install is all-important (though I am happy to tweak the code if I have to).

My preference is for a perl script (i.e. an file), but PHP would be acceptable (index.php). Those are the only DirectoryIndex options on the server.


I have decided to use snif in preference to AutoIndex to solve the current problem, but I am still interested in finding a perl implementation, so if you know of one please post it. Thanks.

Accepted Answer

snif is nice and I think meets all your needs.

Written by Adam Gibbins
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki