find2perl - translate find command lines to Perl code |
find2perl - translate find command lines to Perl code
find2perl [paths] [predicates] | perl
find2perl is a little translator to convert find command lines to equivalent Perl code. The resulting code is typically faster than running find itself.
``paths'' are a set of paths where find2perl will start its searches and ``predicates'' are taken from the following list.
! PREDICATE
!
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 )
find(1)
).
PREDICATE1 PREDICATE2
PREDICATE1 -o PREDICATE2
-follow
-follow
option. If it precedes the file
check option, an stat
is done which means the file check applies to the
file the symbolic link is pointing to. If -follow
option follows the
file check option, this now applies to the symbolic link itself, i.e.
an lstat
is done.
-depth
-prune
-xdev
-name GLOB
find(1)
).
-perm PERM
-perm -PERM
-type X
-X
operator.
-fstype TYPE
-user USER
-group GROUP
-nouser
-nogroup
-inum INUM
-links N
-size N
-atime N
-ctime N
-mtime N
-newer FILE
-print
-print0
-exec OPTIONS ;
exec()
the arguments in OPTIONS in a subprocess; any occurrence of {} in
OPTIONS will first be substituted with the path of the current
file. Note that the command ``rm'' has been special-cased to use perl's
unlink()
function instead (as an optimization). 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)
).
-ok OPTIONS ;
;
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)
).
-eval EXPR
eval()
the EXPR.
-ls
-exec ls -dils {} ;
-tar FILE
-cpio FILE
-ncpio FILE
Predicates which take a numeric argument N can come in three forms:
* N is prefixed with a +: match values greater than N * N is prefixed with a -: match values less than N * N is not prefixed with either + or -: match only values equal to N
find
find2perl - translate find command lines to Perl code |