malaga has asked for the wisdom of the Perl Monks concerning the following question:

when using $basedir, how can i exclude subdirectories?

Replies are listed 'Best First'.
Re: $basedir exclusion
by eg (Friar) on Jan 20, 2001 at 06:20 UTC

    I think you're going to have to be more specific here. What $basedir are you talking about?

    In general, if you're doing some sort of recursive directory traversal, you'll want to test high up in the loop whether or not the current directory is excluded. If it is, then return immediately (which automatically excludes everything below the current directory), otherwise keep on descending.

    Otherwise you can just make a list of everything below $basedir and grep out whatever you want to exclude.

Re: $basedir exclusion
by Beatnik (Parson) on Jan 20, 2001 at 15:47 UTC