Track /etc/gitconfig
[msysgit/mtrensch.git] / lib / perl5 / 5.8.8 / finddepth.pl
blobbfa44bb1bc9d51d071ca04c1844bc63b1d7ae71a
1 # Usage:
2 # require "finddepth.pl";
4 # &finddepth('/foo','/bar');
6 # sub wanted { ... }
7 # where wanted does whatever you want. $dir contains the
8 # current directory name, and $_ the current filename within
9 # that directory. $name contains "$dir/$_". You are cd'ed
10 # to $dir when the function is called. The function may
11 # set $prune to prune the tree.
13 # This library is primarily for find2perl, which, when fed
15 # find2perl / -name .nfs\* -mtime +7 -exec rm -f {} \; -o -fstype nfs -prune
17 # spits out something like this
19 # sub wanted {
20 # /^\.nfs.*$/ &&
21 # (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
22 # int(-M _) > 7 &&
23 # unlink($_)
24 # ||
25 # ($nlink || (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_))) &&
26 # $dev < 0 &&
27 # ($prune = 1);
28 # }
31 use File::Find ();
33 *name = *File::Find::name;
34 *prune = *File::Find::prune;
35 *dir = *File::Find::dir;
36 *topdir = *File::Find::topdir;
37 *topdev = *File::Find::topdev;
38 *topino = *File::Find::topino;
39 *topmode = *File::Find::topmode;
40 *topnlink = *File::Find::topnlink;
42 sub finddepth {
43 &File::Find::finddepth(\&wanted, @_);