Use File::Find in V5.6.1 of perl or higher.

-----Original Message-----
From: John [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 12:56 PM
To: [EMAIL PROTECTED]
Subject: directory tree minus certain directories


Is this the right/best way to do this?  I wanted to use File::Find 
but couldn't figure out how to exclude directories.  I want to display 
a directory tree, but I don't want to display the directories called 
WORKAREA, STAGING, EDITION, or .raw, and I don't want to search those 
directories for subdirectories either.

This is on NT, I'm not sure that matters.  Anyone else using Interwoven 
TeamSh?ite?

use strict;
require TeamSite::Config;

my $iwmount = TeamSite::Config::iwgetmount();
my @list = ();
addSubDirs( $iwmount, \@list );
print join( "\n", @list );

sub addSubDirs
{
    my $dir = shift( @_ );
    my $list = shift( @_ );
    local *DIR;
    opendir( DIR, $dir ) || die( "opendir $dir fails : $!" );

    while( defined( my $sub = readdir( DIR )))
    {
        if ( $sub !~ m#^(EDITION|WORKAREA|STAGING|\.{1,2}|\.raw)$# 
&& -d "${dir}\\${sub}" )
        {
            addSubDirs( "${dir}/${sub}" );
        }
    }

    closedir( DIR );
    push( @list, $dir );
}








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

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to