[prev in list] [next in list] [prev in thread] [next in thread]
List: wuftpd-questions
Subject: Re: script to generate directory listings
From: Kenneth Porter <shiva () well ! com>
Date: 2002-06-26 2:07:41
[Download RAW message or body]
I'd add a cd to each directory, and eliminate the directory name from
the ls command. Without that, the listing shows the full host path,
which is probably undesirable in a virtual hosting environment.
I just noticed that neither Opera nor IE6 can display a .gz file, so my
tendency would be to first generate a non-compressed file with a .txt
extension, and then generate a gzipped copy in a separate step. (I'm
pretty sure that Opera will gunzip a file if sent over HTTP, though, as
it then has a Content-encoding to clue it to what to do.)
On Tue, 2002-06-25 at 17:35, john traenky wrote:
> Please forgive this digression into shell scripting,
> Oh Moderator gods. This script is useful enough for
> many ftp admins that I hope you will forgive without
> revoking future access for me?
>
> #!/bin/bash
>
> for $ftpdir in `find {ftproot} -type d`
> do
> ls -lR $ftpdir |gzip -c > ./$ftpdir/filelist.gz
> done
>
> This script will only work if written with vi. emac
> users will find this particular set of keystrokes
> will, in fact, lead to dehibilitating hand injuries
> once only known to WordPerfect users... 8-)
>
> jt
>
> teach yourself shell programming in 24 hours is an
> excellent reference
>
>
> --- Kenneth Porter <shiva@well.com> wrote:
> > On Tue, 2002-06-25 at 14:02, john traenky wrote:
> > > ls -lR {dir name} | gzip -c > DirFilelisting.gz ?
> > >
> > > You could even make a script that uses find [find
> > > {dirname} -type d] to isolate each subdir in the
> > > ftproot and then ls that dir and then create a
> > file
> > > that uses each dir value to output the file in the
> > > correct dir--in a loop.
> > >
> > > if inerested, I'll work on the script.
> >
> > Thanks! Looks like it's almost a one-liner. One
> > could use something
> > like:
> >
> > find $FTPROOT -type d -exec make-lslR {} \;
> >
> > and then invoked your suggested command from a
> > function or secondary
> > script, maybe:
> >
> > make-lslR()
> > {
> > cd $1
> > rm -f ls-lR.gz
> > ls -lR | gzip -c ls-lR.gz
> > }
> >
> > (My syntax may be off.)
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic