[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

Sortable table of directory details

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
Kim Ryan
Asked:
Kim Ryan
  • 3
  • 2
1 Solution
 
samriCommented:
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
 
Kim RyanIT ConsultantAuthor Commented:
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
 
samriCommented:
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
 
Kim RyanIT ConsultantAuthor Commented:
Thanks, I think I will just have to use perl to do some custom sorting
0
 
samriCommented:
no. prob.,
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now