File::Find is a Perl module to traverse a directory tree.
SYNOPSIS
use File::Find;
find(&wanted, @directories_to_search);
sub wanted { ... }
use File::Find;
finddepth(&wanted, @directories_to_search);
sub wanted { ... }
use File::Find;
find({ wanted => &process, follow => 1 }, '.');
These are functions for searching through directory trees doing work on each file found similar to the Unix find command. File::Find exports two functions, find and finddepth. They work similarly but have subtle differences.
find
find(&wanted, @directories);
find(%options, @directories);
find() does a depth-first search over the given @directories in the order they are given. For each file or directory found, it calls the &wanted subroutine. (See below for details on how to use the &wanted function). Additionally, for each directory found, it will chdir() into that directory and continue the search, invoking the &wanted function on each file or subdirectory in the directory.
finddepth
finddepth(&wanted, @directories);
finddepth(%options, @directories);
finddepth() works just like find() except that is invokes the &wanted function for a directory after invoking it for the directory's contents. It does a postorder traversal instead of a preorder traversal, working from the bottom of the directory tree up where find() works from the top of the tree down.
Product's homepage
Requirements:
· Perl