Ashish Srivastava wrote:
> How can i restrict scanning by find function to a specified depth.
> eg. only 4 level or 3 level.

Whenever your 'wanted' callback routine is called with
a directory name in $_, if you set

  $File::Find::prune = 1

then 'find' won't look at any files in that directory or below.
You'll have to calculate the current directory level yourself but,
if you're on a Unix-like filing system, then in general you can just
count the slash characters like this

  my $level = $File::Find::dir =~ tr#/##;
  $File::Find::prune = 1 if $level >= 3;

which will process everything down to, say, /usr/bin/perl
but nothing beneath it.

HTH,

Rob







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

Reply via email to