Solved

Sortable table of directory details

Posted on 2002-05-27
5
171 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

911 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

23 Experts available now in Live!

Get 1:1 Help Now