USE File::Find
either that or you have to mess around with recursion which can be quite
tricky
File::Find does the recursion for you. docs are easy to follow

> -----Original Message-----
> From: LinkS On WeB [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, July 07, 2002 2:46 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: trying to find direcotries
> 
> 
> Ok listen im trying to fin all the direcotries that
> are in a folder, I mean everyone. But for some reason
> this only prints out the first folder and not the sub
> folders.
> 
> <code>
> my @alldir = finddir("$config{home}$user{site_id}");
> print $_, "\n" for @alldir;
> 
> sub finddir {
> 
>    my $root = shift;
>    chomp $root;
>    $root = $root . '/' unless ( $root =~ m|/$| );
>    local *DIR;
>    opendir DIR, $root or die $!;
>    my @userfiles = sort grep !/^\.\.?\z/, readdir DIR;
>    my @direct;
>    foreach my $file (@userfiles) {
>        next unless ( -d "$root$file" );
>        finddir("$root$file");
>        my $dir = "$root$file";
>        $dir =~ s/^\Q$config{home}$user{site_id}\E//;
>        push(@direct, $dir);
>    }
>    return @direct;
> }
> </code>
> 
> -Andrew
> 
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to