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

Replies are listed 'Best First'.
Re: Recursive file find and copy
by steves (Curate) on Feb 25, 2003 at 04:44 UTC

    There's still some confusion at the end there. If I understand your problem, I think you want this:

    for my $dir ( @directories ) { find(\&process_directories, $dir); } sub process_directories { if ($File::Find::dir ne $dir) { $File::Find::prune = 1; return 0; } return 0 if ($_ !~ /\.rtf$/); copy($File::Find::name, "C:\\testfiles\\$_") or die "Failed to cop +y $_: $!\n"; return 1; }