Solved

Sortable table of directory details

Posted on 2002-05-27
5
170 Views
Last Modified: 2013-12-25
I want to be able to display details of a directory as a  HTML table. Columns would include file name, size, date modified etc. I would then like to allow the user to sort by a column, say size or date in ascending or descending order. I guess this means a CGI form. As this seems like a common task, I REALLY want to use some sort of tool or module., not program from scratch. I have looked at HTML::Table and CGI::FormBuilder. Any recommendations?
0
Comment
Question by:Kim Ryan
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:samri
ID: 7038390
I doesn't seem to see any module to do that yet.  

But it can be achieved with a combination of
Modules - HTML::Table, File::List
Function - opendir, readdir, stat, sort

and of course, you might need Perl.

What is you OS, and webserver platform btw?




0
 
LVL 19

Author Comment

by:Kim Ryan
ID: 7038394
Am using Linux and perl. I already have the code to build the file stats, problem is just with presentation. I noticed that some directory listings like CPAN have a column heading you can click and the table resorts itself by that field. For example:

http://www.cpan.org/modules/by-module/Apache/BARRACODE/
has a HREF in the size column
http://www.cpan.org/modules/by-module/Apache/BARRACODE/?S=A
click it and you get results sorted by size ascending. Click it again (the HREF is now ?S=D) and it descends. Is this handled by the server, ie some httpd.conf setting for directory browsing?
0
 
LVL 15

Accepted Solution

by:
samri earned 200 total points
ID: 7038410
Yes, it was apache that does that.  Take a look at mod_autoindex http://httpd.apache.org/docs/mod/mod_autoindex.html

and make sure that the Directory directive is configured to allow directory browsing.  By default Apache is restrictive as not to allow dir browsing.

You can give it a try.

Alias /test "/somewhere/path"
<Directory "/somewhere/path">
     Options Indexes Multiviews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

good luck.
0
 
LVL 19

Author Comment

by:Kim Ryan
ID: 7038595
Thanks, I think I will just have to use perl to do some custom sorting
0
 
LVL 15

Expert Comment

by:samri
ID: 7038612
no. prob.,
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now