directory

  07/02/2006

walk

Recursively walks trought directories and execute a 'doit' fonction. This example uses 'Find' and 'Basename' standard module.

exemple:


#!/usr/local/bin/perl
use File::Find;
use File::Basename;

@ARGV=qw(.) if not @ARGV;
find(\&doit, @ARGV);

#function to execute
sub doit {
   $fpath=$File::Find::name;
   $fname=basename($fpath);
#   print "$fname $fpath\n";
}

see also

previous