On 05/23/00, ""Douglas Wilson" <[EMAIL PROTECTED]>" wrote:
> > > one.html which contains something like
> > > one
> > > - a
> > > - b
> > > two
> > > three
Here's a simpler version, even though I'm still not
sure that its what he was originally after (really,
I gotta get back to work now :)
#!/usr/bin/perl -l -w
use File::Find;
my $top_dir="/home/dougw/tmp/root";
my (%children, %parent);
find(\&mk_tree, $top_dir);
chdir $top_dir or die "Can't cd to $top_dir: $!";
open(INDEX, ">index.html") or die "Can't write to index.html in $top_dir:
$!";
print_children($top_dir);
close INDEX;
chdir ".." or die "Can't cd to $top_dir/..: $!";
find(\&print_tree, $top_dir);
sub mk_tree {
return if $_ eq "." or ! -d;
$parent{$File::Find::name}=$File::Find::dir;
push @{$children{$File::Find::dir}}, $_;
}
sub print_tree {
return if $_ eq "." or ! -d;
open(INDEX, ">$_/index.html")
or die "Can't open index.html in $File::Find::name: $!";
for my $dir (@{$children{$parent{$File::Find::name}}}) {
print INDEX $dir;
print_children($File::Find::name,1) if $dir eq $_;
}
close INDEX;
}
sub print_children {
my $dir = shift;
my $indent = shift;
for my $child (@{$children{$dir}}) {
print INDEX ($indent?"-":""), $child;
}
}
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]