uday_sagar has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I think this is one of already asked questions!
I want the script to list all the directories that are at some depth which will be specified by the user.
The code I have is finding all the directories recursively. I want only at a particular level.
use Cwd; use File::Find; my $dir = getcwd; find(\&print_name_if_dir, "$dir"); sub print_name_if_dir { if (-d) { print $_."\n"; } }
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding directories at a variable depth
by daxim (Curate) on Aug 01, 2012 at 12:23 UTC | |
|
Re: Finding directories at a variable depth
by RichardK (Parson) on Aug 01, 2012 at 11:56 UTC | |
|
Re: Finding directories at a variable depth
by nemesdani (Friar) on Aug 01, 2012 at 12:03 UTC | |
|
Re: Finding directories at a variable depth
by Ratazong (Monsignor) on Aug 01, 2012 at 11:36 UTC | |
|
Re: Finding directories at a variable depth
by zentara (Cardinal) on Aug 01, 2012 at 14:46 UTC | |
by uday_sagar (Scribe) on Aug 02, 2012 at 09:31 UTC | |
by uday_sagar (Scribe) on Aug 02, 2012 at 09:54 UTC | |
by zentara (Cardinal) on Aug 02, 2012 at 11:13 UTC | |
|
Re: Finding directories at a variable depth
by uday_sagar (Scribe) on Aug 02, 2012 at 13:18 UTC |