start page | rating of books | rating of authors | reviews | copyrights

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: 8.73 File::Find Chapter 8
Standard Modules
Next: Reference: finddepth
 

find

find (\&

wanted

, 

dir1

[, 

dir2

 ...])

Works like the Unix find command; traverses the specified directories, looking for files that match the expressions or actions you specify in a subroutine called wanted , which you must define. For example, to print out the names of all executable files, you could define wanted this way:

sub wanted {     print "$File::Find::name\n" if -x; }
Provides the following variables:

$File::Find::dir

Current directory name ( $_ has the current filename in that directory).

$File::Find::name

Contains "$File::Find::dir/$_" . You are chdir ed to $File::Find::dir when find is called.

$File::Find::prune

If true, find does not descend into any directories.

$File::Find::dont_use_nlink

Set this variable if you're using the Andrew File System (AFS).


Previous: 8.73 File::Find Perl in a Nutshell Next: Reference: finddepth
8.73 File::Find Book Index Reference: finddepth

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.