*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> perl5/File::Find (3)              


File::Find(3)							 File::Find(3)

NAME    [Toc]    [Back]

     find - traverse a file tree

     finddepth - traverse a directory structure	depth-first

SYNOPSIS    [Toc]    [Back]

	 use File::Find;
	 find(\&wanted,	'/foo','/bar');
	 sub wanted { ... }

	 use File::Find;
	 finddepth(\&wanted, '/foo','/bar');
	 sub wanted { ... }

DESCRIPTION    [Toc]    [Back]

     The wanted() function does	whatever verifications you want.
     $File::Find::dir contains the current directory name, and $_ the current
     filename within that directory.  $File::Find::name	contains
     "$File::Find::dir/$_".  You are chdir()'d to $File::Find::dir when	the
     function is called.  The function may set $File::Find::prune to prune the

     File::Find	assumes	that you don't alter the $_ variable.  If you do then
     make sure you return it to	its original value before exiting your

     This library is primarily for the find2perl tool, which when fed,

	 find2perl / -name .nfs\* -mtime +7 \
	     -exec rm -f {} \; -o -fstype nfs -prune

     produces something	like:

	 sub wanted {
	     /^\.nfs.*$/ &&
	     (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
	     int(-M _) > 7 &&
	     ($nlink ||	(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
	     $dev < 0 &&
	     ($File::Find::prune = 1);

     Set the variable $File::Find::dont_use_nlink if you're using AFS, since
     AFS cheats.

     finddepth is just like find, except that it does a	depth-first search.

									Page 1

File::Find(3)							 File::Find(3)

     Here's another interesting	wanted function.  It will find all symlinks
     that don't	resolve:

	 sub wanted {
	     -l	&& !-e && print	"bogus link: $File::Find::name\n";

BUGS    [Toc]    [Back]

     There is no way to	make find or finddepth follow symlinks.

									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
ypfiles IRIX the NIS database and directory structure
nisfiles HP-UX NIS+ database files and directory structure
dtfilsys HP-UX CDE file system; directory tree structure
ypfiles HP-UX Network Information Service database and directory structure
ypfiles Tru64 Network Information Service (NIS) database and directory structure
getdcm IRIX indicates whether depth-cue mode is on or off
glDepthFunc Tru64 specify the value used for depth buffer comparisons
depthcue IRIX turns depth-cue mode on and off
lsetdepth IRIX sets the depth range
glClearDepth Tru64 specify the clear value for the depth buffer
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service