Simple script to replace Apache's mod_autoindex with a user-friendly directory listing
Asked Answered
D

3

0

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 index.pl file), but PHP would be acceptable (index.php). Those are the only DirectoryIndex options on the server.

Update

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.

Desmarais answered 18/1, 2009 at 7:32 Comment(0)
D
3

snif is nice and I think meets all your needs. Link

Dallman answered 18/1, 2009 at 19:36 Comment(3)
Better. I have used snif because it is relatively easy to tweak, isn't too big, and because nobody has posted a perl solution.Desmarais
i am in a shared hosting env and i want to use a custom directory listing script. what should i do?Woolery
Thanks to WayBack Machine Page Backed To Life linkMaiden
P
1

I guess AutoIndex could solve your problem.

Promiscuous answered 18/1, 2009 at 8:59 Comment(1)
I gave it a try, and it fits the description, but it does too much and is too large and confusing. Close though, thanks.Desmarais
D
-1

in your httpd.conf file or with:

use Apache::Icon (); use Apache::AutoIndex;

from : cpansearch.perl.org/src/GOZER/Apache-AutoIndex-0.08/AutoIndex.pm

from: http://www.google.com/search?num=20&q=perl+Apache%3A%3AAutoIndex

Daynadays answered 24/9, 2010 at 20:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.