FIND2PERL(1) Perl Programmers Reference Guide FIND2PERL(1)
NAME
find2perl - translate find command lines to Perl code
SYNOPSIS
find2perl [paths] [predicates] | perl
DESCRIPTION
find2perl is a little translator to convert find command lines to
equivalent Perl code. The resulting code is typically faster than run-
ning find itself.
"paths" are a set(7,n,1 builtins) of paths where find2perl will start its searches and
"predicates" are taken from the following list.
"! PREDICATE"
Negate the sense of the following predicate. The "!" must be
passed as a distinct argument, so it may need to be surrounded by
whitespace and/or quoted from interpretation by the shell using a
backslash (just as with using find(1)).
"( PREDICATES )"
Group the given PREDICATES. The parentheses must be passed as dis-
tinct arguments, so they may need to be surrounded by whitespace
and/or quoted from interpretation by the shell using a backslash
(just as with using find(1)).
"PREDICATE1 PREDICATE2"
True if(3,n) _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is
not evaluated if(3,n) PREDICATE1 is false.
"PREDICATE1 -o PREDICATE2"
True if(3,n) either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2
is not evaluated if(3,n) PREDICATE1 is true.
"-follow"
Follow (dereference) symlinks. The checking of file(1,n) attributes
depends on the position of the "-follow" option. If it precedes the
file(1,n) check option, an "stat(1,2)" is done which means the file(1,n) check
applies to the file(1,n) the symbolic link(1,2) is pointing to. If "-follow"
option follows the file(1,n) check option, this now applies to the sym-
bolic link(1,2) itself, i.e. an "lstat" is done.
"-depth"
Change directory traversal algorithm from breadth-first to
depth-first.
"-prune"
Do not descend into the directory currently matched.
"-xdev"
Do not traverse mount(2,8) points (prunes search at mount-point directo-
ries).
"-name GLOB"
File name matches specified GLOB wildcard pattern. GLOB may need
to be quoted to avoid interpretation by the shell (just as with
using find(1)).
"-perm PERM"
Low-order 9 bits of permission match octal value PERM.
"-perm -PERM"
The bits specified in(1,8) PERM are all set(7,n,1 builtins) in(1,8) file(1,n)'s permissions.
"-type X"
The file(1,n)'s type matches perl's "-X" operator.
"-fstype TYPE"
Filesystem of current path is of type TYPE (only NFS/non-NFS dis-
tinction is implemented).
"-user USER"
True if(3,n) USER is owner of file.
"-group GROUP"
True if(3,n) file(1,n)'s group is GROUP.
"-nouser"
True if(3,n) file(1,n)'s owner is not in(1,8) password database.
"-nogroup"
True if(3,n) file(1,n)'s group is not in(1,8) group database.
"-inum INUM"
True file(1,n)'s inode number is INUM.
"-links N"
True if(3,n) (hard) link(1,2) count of file(1,n) matches N (see below).
"-size N"
True if(3,n) file(1,n)'s size matches N (see below) N is normally counted in(1,8)
512-byte blocks, but a suffix of "c" specifies that size should be
counted in(1,8) characters (bytes) and a suffix of "k" specifes that
size should be counted in(1,8) 1024-byte blocks.
"-atime N"
True if(3,n) last-access time(1,2,n) of file(1,n) matches N (measured in(1,8) days) (see
below).
"-ctime N"
True if(3,n) last-changed time(1,2,n) of file(1,n)'s inode matches N (measured in(1,8)
days, see below).
"-mtime N"
True if(3,n) last-modified time(1,2,n) of file(1,n) matches N (measured in(1,8) days, see
below).
"-newer FILE"
True if(3,n) last-modified time(1,2,n) of file(1,n) matches N.
"-print"
Print out path of file(1,n) (always true). If none of "-exec", "-ls",
"-print0", or "-ok" is specified, then "-print" will be added
implicitly.
"-print0"
Like -print, but terminates with \0 instead of \n.
"-exec OPTIONS ;"
exec(3,n,1 builtins)() the arguments in(1,8) OPTIONS in(1,8) a subprocess; any occurrence of
{} in(1,8) OPTIONS will first be substituted with the path of the cur-
rent file. Note that the command "rm" has been special-cased to
use perl's unlink(1,2)() function instead (as an optimization). The ";"
must be passed as a distinct argument, so it may need to be sur-
rounded by whitespace and/or quoted from interpretation by the
shell using a backslash (just as with using find(1)).
"-ok OPTIONS ;"
Like -exec, but first prompts user; if(3,n) user's response does not
begin with a y, skip the exec. The ";" must be passed as a dis-
tinct argument, so it may need to be surrounded by whitespace
and/or quoted from interpretation by the shell using a backslash
(just as with using find(1)).
"-eval EXPR"
Has the perl script eval() the EXPR.
"-ls"
Simulates "-exec ls -dils {} ;"
"-tar FILE"
Adds current output to tar-format FILE.
"-cpio FILE"
Adds current output to old-style cpio-format FILE.
"-ncpio FILE"
Adds current output to "new"-style cpio-format FILE.
Predicates which take a numeric argument N can come in(1,8) three forms:
* N is prefixed with a +: match values greater than N
* N is prefixed with a -: match values less(1,3) than N
* N is not prefixed with either + or -: match only values equal to N
SEE ALSO
find
perl v5.8.5 2004-09-17 FIND2PERL(1)