1FIND2PERL(1) User Contributed Perl Documentation FIND2PERL(1)
2
3
4
6 find2perl - translate find command lines to Perl code
7
9 find2perl [paths] [predicates] | perl
10
12 find2perl is a little translator to convert find command lines to
13 equivalent Perl code. The resulting code is typically faster than
14 running find itself.
15
16 "paths" are a set of paths where find2perl will start its searches and
17 "predicates" are taken from the following list.
18
19 "! PREDICATE"
20 Negate the sense of the following predicate. The "!" must be
21 passed as a distinct argument, so it may need to be surrounded by
22 whitespace and/or quoted from interpretation by the shell using a
23 backslash (just as with using find(1)).
24
25 "( PREDICATES )"
26 Group the given PREDICATES. The parentheses must be passed as
27 distinct arguments, so they may need to be surrounded by whitespace
28 and/or quoted from interpretation by the shell using a backslash
29 (just as with using find(1)).
30
31 "PREDICATE1 PREDICATE2"
32 True if _both_ PREDICATE1 and PREDICATE2 are true; PREDICATE2 is
33 not evaluated if PREDICATE1 is false.
34
35 "PREDICATE1 -o PREDICATE2"
36 True if either one of PREDICATE1 or PREDICATE2 is true; PREDICATE2
37 is not evaluated if PREDICATE1 is true.
38
39 "-follow"
40 Follow (dereference) symlinks. The checking of file attributes
41 depends on the position of the "-follow" option. If it precedes the
42 file check option, an "stat" is done which means the file check
43 applies to the file the symbolic link is pointing to. If "-follow"
44 option follows the file check option, this now applies to the
45 symbolic link itself, i.e. an "lstat" is done.
46
47 "-depth"
48 Change directory traversal algorithm from breadth-first to depth-
49 first.
50
51 "-prune"
52 Do not descend into the directory currently matched.
53
54 "-xdev"
55 Do not traverse mount points (prunes search at mount-point
56 directories).
57
58 "-name GLOB"
59 File name matches specified GLOB wildcard pattern. GLOB may need
60 to be quoted to avoid interpretation by the shell (just as with
61 using find(1)).
62
63 "-iname GLOB"
64 Like "-name", but the match is case insensitive.
65
66 "-path GLOB"
67 Path name matches specified GLOB wildcard pattern.
68
69 "-ipath GLOB"
70 Like "-path", but the match is case insensitive.
71
72 "-perm PERM"
73 Low-order 9 bits of permission match octal value PERM.
74
75 "-perm -PERM"
76 The bits specified in PERM are all set in file's permissions.
77
78 "-type X"
79 The file's type matches perl's "-X" operator.
80
81 "-fstype TYPE"
82 Filesystem of current path is of type TYPE (only NFS/non-NFS
83 distinction is implemented).
84
85 "-user USER"
86 True if USER is owner of file.
87
88 "-group GROUP"
89 True if file's group is GROUP.
90
91 "-nouser"
92 True if file's owner is not in password database.
93
94 "-nogroup"
95 True if file's group is not in group database.
96
97 "-inum INUM"
98 True file's inode number is INUM.
99
100 "-links N"
101 True if (hard) link count of file matches N (see below).
102
103 "-size N"
104 True if file's size matches N (see below) N is normally counted in
105 512-byte blocks, but a suffix of "c" specifies that size should be
106 counted in characters (bytes) and a suffix of "k" specifies that
107 size should be counted in 1024-byte blocks.
108
109 "-atime N"
110 True if last-access time of file matches N (measured in days) (see
111 below).
112
113 "-ctime N"
114 True if last-changed time of file's inode matches N (measured in
115 days, see below).
116
117 "-mtime N"
118 True if last-modified time of file matches N (measured in days, see
119 below).
120
121 "-newer FILE"
122 True if last-modified time of file matches N.
123
124 "-print"
125 Print out path of file (always true). If none of "-exec", "-ls",
126 "-print0", or "-ok" is specified, then "-print" will be added
127 implicitly.
128
129 "-print0"
130 Like -print, but terminates with \0 instead of \n.
131
132 "-exec OPTIONS ;"
133 exec() the arguments in OPTIONS in a subprocess; any occurrence of
134 {} in OPTIONS will first be substituted with the path of the
135 current file. Note that the command "rm" has been special-cased to
136 use perl's unlink() function instead (as an optimization). The ";"
137 must be passed as a distinct argument, so it may need to be
138 surrounded by whitespace and/or quoted from interpretation by the
139 shell using a backslash (just as with using find(1)).
140
141 "-ok OPTIONS ;"
142 Like -exec, but first prompts user; if user's response does not
143 begin with a y, skip the exec. The ";" must be passed as a
144 distinct argument, so it may need to be surrounded by whitespace
145 and/or quoted from interpretation by the shell using a backslash
146 (just as with using find(1)).
147
148 "-eval EXPR"
149 Has the perl script eval() the EXPR.
150
151 "-ls"
152 Simulates "-exec ls -dils {} ;"
153
154 "-tar FILE"
155 Adds current output to tar-format FILE.
156
157 "-cpio FILE"
158 Adds current output to old-style cpio-format FILE.
159
160 "-ncpio FILE"
161 Adds current output to "new"-style cpio-format FILE.
162
163 Predicates which take a numeric argument N can come in three forms:
164
165 * N is prefixed with a +: match values greater than N
166 * N is prefixed with a -: match values less than N
167 * N is not prefixed with either + or -: match only values equal to N
168
170 find, File::Find.
171
172
173
174perl v5.28.1 2018-10-15 FIND2PERL(1)