creating htmls from a directory tree?

Nathan Vidican nathan at vidican.com
Wed Feb 10 16:59:35 UTC 2010


Could do something simple with a Perl script as such:

#!/usr/bin/perl

use strict;
my @filenames = `ls`;

print "Content-type: text/html\n\n";

print "See the list below, click an item to open it: <br>\n<lui>\n";
foreach my $F (@files) {
  print "  <li><a href=\"$F\">$F</a></li>\n";
}
print "</lui>\n";

# EOF

You could, of course, get much fancier as it goes - but that's the quick and
dirty of doing it with a simple cgi script anyways.

--
Nathan Vidican
nathan at vidican.com

On Wed, Feb 10, 2010 at 11:37 AM, Anton Shterenlikht <mexas at bristol.ac.uk>wrote:

> On Wed, Feb 10, 2010 at 12:35:12PM -0300, Daniel Molina Wegener wrote:
> > On Wednesday 10 February 2010,
> > Anton Shterenlikht <mexas at bristol.ac.uk> wrote:
> >
> > > On Wed, Feb 10, 2010 at 10:05:36AM -0500, Bill Moran wrote:
> > > > In response to Anton Shterenlikht <mexas at bristol.ac.uk>:
> > > > > I'd like to upload a directory structure to a web
> > > > > server. I'd like to create in each subdirectory
> > > > > an index.html with a simple list of files in this
> > > > > directory for a simple browsing.
> > > > >
> > > > > This sounds like a perl or shell script, but
> > > > > I was wondering if there is someting like
> > > > > this already available from ports. I couldn't
> > > > > find anything suitable.
> > > >
> > > > You could just turn on Apache's built-in directory listing capability
> > > > and Apache will create those files on-demand.
> > >
> > > I see.. I need to talk to the web server guys then.
> >
> >   Also you can try WebDAV modules and clients ;)
>
> After a quick read on wikipedia,
> I think it's very unlikely the web server guys will
> be happy with this, from the security point of view.
>
> Anyway, thanks for the idea, now I know.
> anton
>
> --
> Anton Shterenlikht
> Room 2.6, Queen's Building
> Mech Eng Dept
> Bristol University
> University Walk, Bristol BS8 1TR, UK
> Tel: +44 (0)117 331 5944
> Fax: +44 (0)117 929 4423
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"
>


More information about the freebsd-questions mailing list