471,583 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,583 software developers and data experts.

Command-line program for pretty dir listings needed

Hello,

if HTML authoring includes HTML autogeneration, this request is on-topic.
Otherwise please forgive me and point me in the right direction.

I'd like to make a bunch of dirs full of files available on a web server. Of
course I could just leave them like they are and have the server take care
of the listings. I don't like that because the listing is entirely
server-dependent, if the server allows dir listings at all. On the server
I'm using the listing is ugly to boot because the server doesn't display
UTF-8 characters correctly; it also doesn't show file sizes and dates.

So what I'm looking for is some little program which, when invoked in a
directory, will produce an index.html file listing the files in that dir,
including date and file size. With a link to the respective file itself of
course.

I could cook up somthing like that myself but I thought, maybe it exists. I
found a couple of PHP scripts that sort of do what I want, but I'd like to
use this method also with local (server-less) file access.

Finally, since I use makefiles to autogenerate my website, the program
should work from the command-line without user intervention. And on Linux.

Suggestions, anyone?

robert
Aug 17 '07 #1
5 2258
Scripsit Robert Latest:
if HTML authoring includes HTML autogeneration, this request is
on-topic. Otherwise please forgive me and point me in the right
direction.
It's not about HTML but server-side operations, so c.i.w.a.tools or
c.i.w.a.misc would have been a better choice. This sounds mostly like a
tools question, so I'm sending this to c.i.w.a.tools too and setting
followups there.
I'd like to make a bunch of dirs full of files available on a web
server. Of course I could just leave them like they are and have the
server take care of the listings. I don't like that because the
listing is entirely server-dependent, if the server allows dir
listings at all.
That's true, but the situation is server-dependent anyway (unless you do
preprocessing: generate the listing yourself and upload it whenever you make
a change to the collection of files). If you use, say, PHP to generate the
listing, then you would have to change something if you move the site to a
system where PHP is not allowed.
On the server I'm using the listing is ugly to boot
because the server doesn't display UTF-8 characters correctly; it
also doesn't show file sizes and dates.
Well, that's a good enough reason to something about it. However, it's not
certain that existing software for your purposes will do UTF-8 either.
So what I'm looking for is some little program which, when invoked in
a directory, will produce an index.html file listing the files in
that dir, including date and file size. With a link to the respective
file itself of course.
You get more challenges (and, if successful, better results) if you use
short codes or icons that indicate the type of each file (like DOC, GIF
etc.), if there are different types.
Finally, since I use makefiles to autogenerate my website, the program
should work from the command-line without user intervention. And on
Linux.
Oh, then you're doing preprocessing, and you have different options. I'm
pretty sure there are utilities for your purposes, but writing a suitable
one might be easier than finding a suitable one. :-) Sounds like a job for
Perl.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Aug 17 '07 #2
On Fri, 17 Aug 2007, Robert Latest wrote:
I'd like to make a bunch of dirs full of files available on a web server.
Address (URL)? Which server software?
I'm using the listing is ugly to boot because the server doesn't display
UTF-8 characters correctly;
You must use "percent encoding" by RFC 3986.
http://www.unics.uni-hannover.de/nhtcapri/%25/
So what I'm looking for is some little program which, when invoked in a
directory, will produce an index.html file listing the files in that dir,
including date and file size. With a link to the respective file itself of
course.
Apache can do this for you.
http://httpd.apache.org/docs/1.3/mod/mod_autoindex.html
Aug 17 '07 #3
On 8/17/2007 6:49 AM, Robert Latest wrote:
Hello,

if HTML authoring includes HTML autogeneration, this request is on-topic.
Otherwise please forgive me and point me in the right direction.

I'd like to make a bunch of dirs full of files available on a web server. Of
course I could just leave them like they are and have the server take care
of the listings. I don't like that because the listing is entirely
server-dependent, if the server allows dir listings at all. On the server
I'm using the listing is ugly to boot because the server doesn't display
UTF-8 characters correctly; it also doesn't show file sizes and dates.

So what I'm looking for is some little program which, when invoked in a
directory, will produce an index.html file listing the files in that dir,
including date and file size. With a link to the respective file itself of
course.

I could cook up somthing like that myself but I thought, maybe it exists. I
found a couple of PHP scripts that sort of do what I want, but I'd like to
use this method also with local (server-less) file access.

Finally, since I use makefiles to autogenerate my website, the program
should work from the command-line without user intervention. And on Linux.

Suggestions, anyone?

robert
Go to my home page (per my signature below). Scroll to the bottom.
Select "Index of HTML Files". Is this something similar to what you want?

--
David E. Ross
<http://www.rossde.com/>

Natural foods can be harmful: Look at all the
people who die of natural causes.
Aug 17 '07 #4
["Followup-To:" header set to comp.infosystems.www.authoring.html.]
Andreas Prilop wrote:
On Fri, 17 Aug 2007, Robert Latest wrote:
>I'd like to make a bunch of dirs full of files available on a web server.

Address (URL)? Which server software?
Doesn't matter because it needs to be portable across servers.
Apache can do this for you.
http://httpd.apache.org/docs/1.3/mod/mod_autoindex.html
Maybe it can; however, the page is served by unknown software from
inaccessible hardware.

robert
Aug 20 '07 #5
Michael Stemper wrote:
#!/bin/ksh
# Index generator
[...]

Yeah, I've written a similar shell script (even simpler; it doesn't look
into the HTML because I'm mostly serving PDFs).

robert
Aug 20 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Hugh Macdonald | last post: by
8 posts views Thread by Siemel Naran | last post: by
8 posts views Thread by Charles Law | last post: by
4 posts views Thread by FluffyCat | last post: by
3 posts views Thread by Michael Roebuck | last post: by
2 posts views Thread by luanhoxung | last post: by
reply views Thread by czerwww | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.