find2perl

NAME

find2perl - translate find command lines to Perl code

SYNOPSIS

find2perl [path ...] [predicate ...] | perl

DESCRIPTION

The find2perl utility converts find(1) command lines to equivalent Perl code. The resulting code is typically faster than running find itself.

The paths arguments specify where find2perl starts its searches. The predicate arguments can be one of the following:

! predicate
Negate the sense of the following predicate. The ! must be passed as a distinct argument, so it may need to be surrounded by spaces and/or quoted from interpretation by the shell using a backslash (just as with using find).
( predicate ... )
Group the given predicates. The parentheses must be passed as distinct arguments, so they may need to be surrounded by spaces or quoted from interpretation by the shell using a backslash (just as with using find).
predicate1 predicate2
True if both predicate1 and predicate2 are true; predicate2 is not evaluated if predicate1 is false.
predicate1 -o predicate2
True if either predicate1 or predicate2 is true; predicate2 is not evaluated if predicate1 is true.
-follow
Follow (de-reference) symbolic links. The checking of file attributes depends on the position of the -follow option. If it precedes the file-check option, stat(2) is used, which means the file check applies to the file to which the symbolic link is pointing. If the -follow option follows the file-check option, this now applies to the symbolic link itself; that is, lstat(2) 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 points (prunes search at mount-point directories).
-name glob
File-name matches specified glob wildcard pattern. The glob argument may need to be quoted to avoid interpretation by the shell (just as with using find).
-perm perm
Low-order nine bits of permission match octal value perm.
-perm -perm
The bits specified in perm are all set in files' permissions.
-type x
The file's type matches the Perl -x operator.
-fstype type
File system of current path is of type type (only NFS/non-NFS distinction is implemented).
-user user
True if user is owner of file.
-group group
True if file's group is group.
-nouser
True if file's owner is not in password database.
-nogroup
True if file's group is not in group database.
-inum inum
True file's inode number is inum.
-links n
True if (hard) link count of file matches n (see discussion later in this topic).
-size n
True if file's size matches n (see discussion later in this topic). The n argument is normally counted in 512-byte blocks, but a suffix of c specifies that size should be counted in characters (bytes); a suffix of k specifies that size should be counted in 1024-byte blocks.
-atime n
True if last-access time of file matches n (measured in days) (see discussion later in this topic).
-ctime n
True if last-changed time of file's inode matches n (measured in days; see discussion later in this topic).
-mtime n
True if last-modified time of file matches n (measured in days; see discussion later in this topic).
-newer file
True if last-modified time of file matches file.
-print
Print out path of file (always true).
-print0
Like -print, but terminates with \0 instead of \n.
-exec options ;
Call exec(2) with the arguments in options to run in a subprocess; any occurences of {} in options will first be substituted with the path of the current file. Note that the command rm(1) has been special-cased to use the Perl unlink() function instead (as an optimization). The ; must be passed as a distinct argument, so it may need to be surrounded by spaces and/or quoted from interpretation by the shell using a backslash (just as with using find).
-ok options ;
Like -exec, but first prompts user; if the user's response does not begin with a y, do not execute options. The ; must be passed as a distinct argument, so it may need to be surrounded by spaces and/or quoted from interpretation by the shell using a backslash (just as with using find).
-eval expression
Has the Perl script eval() the expression.
-ls
Simulates -exec ls -dils {} ;
-tar file
Adds current output to tar-format file.
-cpio file
Adds current output to old-style copy in-out (cpio)-format file.
-ncpio file
Adds current output to "new"-style cpio-format file.
Predicates that take a numeric argument n can come in the following three forms: