version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
FIND2PERL |
|
|
2 |
!!!FIND2PERL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
SEE ALSO |
|
|
7 |
---- |
|
|
8 |
!!NAME |
|
|
9 |
|
|
|
10 |
|
|
|
11 |
find2perl - translate find command lines to Perl code |
|
|
12 |
!!SYNOPSIS |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
find2perl [[paths] [[predicates] perl |
|
|
16 |
!!DESCRIPTION |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
find2perl is a little translator to convert find command |
|
|
20 |
lines to equivalent Perl code. The resulting code is |
|
|
21 |
typically faster than running find itself. |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
``paths'' are a set of paths where find2perl will start its |
|
|
25 |
searches and ``predicates'' are taken from the following |
|
|
26 |
list. |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
! PREDICATE |
|
|
30 |
|
|
|
31 |
|
|
|
32 |
Negate the sense of the following predicate. The ! |
|
|
33 |
must be passed as a distinct argument, so it may need to be |
|
|
34 |
surrounded by whitespace and/or quoted from interpretation |
|
|
35 |
by the shell using a backslash (just as with using |
|
|
36 |
find(1)). |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
( PREDICATES ) |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
Group the given PREDICATES . The parentheses |
|
|
43 |
must be passed as distinct arguments, so they may need to be |
|
|
44 |
surrounded by whitespace and/or quoted from interpretation |
|
|
45 |
by the shell using a backslash (just as with using |
|
|
46 |
find(1)). |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
PREDICATE1 PREDICATE2 |
|
|
50 |
|
|
|
51 |
|
|
|
52 |
True if _both_ PREDICATE1 and |
|
|
53 |
PREDICATE2 are true; |
|
|
54 |
PREDICATE2 is not evaluated if |
|
|
55 |
PREDICATE1 is false. |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
PREDICATE1 -o PREDICATE2 |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
True if either one of PREDICATE1 or |
|
|
62 |
PREDICATE2 is true; PREDICATE2 |
|
|
63 |
is not evaluated if PREDICATE1 is |
|
|
64 |
true. |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
-follow |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
Follow (dereference) symlinks. The checking of file |
|
|
71 |
attributes depends on the position of the -follow |
|
|
72 |
option. If it precedes the file check option, an |
|
|
73 |
stat is done which means the file check applies to |
|
|
74 |
the file the symbolic link is pointing to. If |
|
|
75 |
-follow option follows the file check option, this |
|
|
76 |
now applies to the symbolic link itself, i.e. an |
|
|
77 |
lstat is done. |
|
|
78 |
|
|
|
79 |
|
|
|
80 |
-depth |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
Change directory traversal algorithm from breadth-first to |
|
|
84 |
depth-first. |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
-prune |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
Do not descend into the directory currently |
|
|
91 |
matched. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
-xdev |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Do not traverse mount points (prunes search at mount-point |
|
|
98 |
directories). |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
-name GLOB |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
File name matches specified GLOB wildcard |
|
|
105 |
pattern. GLOB may need to be quoted to avoid |
|
|
106 |
interpretation by the shell (just as with using |
|
|
107 |
find(1)). |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
-perm PERM |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
Low-order 9 bits of permission match octal value |
|
|
114 |
PERM . |
|
|
115 |
|
|
|
116 |
|
|
|
117 |
-perm -PERM |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
The bits specified in PERM are all set in |
|
|
121 |
file's permissions. |
|
|
122 |
|
|
|
123 |
|
|
|
124 |
-type X |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
The file's type matches perl's -X |
|
|
128 |
operator. |
|
|
129 |
|
|
|
130 |
|
|
|
131 |
-fstype TYPE |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
Filesystem of current path is of type TYPE |
|
|
135 |
(only NFS/non-NFS distinction is implemented). |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
-user USER |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
True if USER is owner of file. |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
-group GROUP |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
True if file's group is GROUP . |
|
|
148 |
|
|
|
149 |
|
|
|
150 |
-nouser |
|
|
151 |
|
|
|
152 |
|
|
|
153 |
True if file's owner is not in password |
|
|
154 |
database. |
|
|
155 |
|
|
|
156 |
|
|
|
157 |
-nogroup |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
True if file's group is not in group database. |
|
|
161 |
|
|
|
162 |
|
|
|
163 |
-inum INUM |
|
|
164 |
|
|
|
165 |
|
|
|
166 |
True file's inode number is INUM |
|
|
167 |
. |
|
|
168 |
|
|
|
169 |
|
|
|
170 |
-links N |
|
|
171 |
|
|
|
172 |
|
|
|
173 |
True if (hard) link count of file matches N (see |
|
|
174 |
below). |
|
|
175 |
|
|
|
176 |
|
|
|
177 |
-size N |
|
|
178 |
|
|
|
179 |
|
|
|
180 |
True if file's size matches N (see below) N is normally |
|
|
181 |
counted in 512-byte blocks, but a suffix of ``c'' specifies |
|
|
182 |
that size should be counted in characters (bytes) and a |
|
|
183 |
suffix of ``k'' specifes that size should be counted in |
|
|
184 |
1024-byte blocks. |
|
|
185 |
|
|
|
186 |
|
|
|
187 |
-atime N |
|
|
188 |
|
|
|
189 |
|
|
|
190 |
True if last-access time of file matches N (measured in |
|
|
191 |
days) (see below). |
|
|
192 |
|
|
|
193 |
|
|
|
194 |
-ctime N |
|
|
195 |
|
|
|
196 |
|
|
|
197 |
True if last-changed time of file's inode matches N |
|
|
198 |
(measured in days, see below). |
|
|
199 |
|
|
|
200 |
|
|
|
201 |
-mtime N |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
True if last-modified time of file matches N (measured in |
|
|
205 |
days, see below). |
|
|
206 |
|
|
|
207 |
|
|
|
208 |
-newer FILE |
|
|
209 |
|
|
|
210 |
|
|
|
211 |
True if last-modified time of file matches N. |
|
|
212 |
|
|
|
213 |
|
|
|
214 |
-print |
|
|
215 |
|
|
|
216 |
|
|
|
217 |
Print out path of file (always true). |
|
|
218 |
|
|
|
219 |
|
|
|
220 |
-print0 |
|
|
221 |
|
|
|
222 |
|
|
|
223 |
Like -print, but terminates with 0 instead of |
|
|
224 |
n. |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
-exec OPTIONS ; |
|
|
228 |
|
|
|
229 |
|
|
|
230 |
''exec()'' the arguments in OPTIONS in a |
|
|
231 |
subprocess; any occurence of {} in OPTIONS |
|
|
232 |
will first be substituted with the path of the current file. |
|
|
233 |
Note that the command ``rm'' has been special-cased to use |
|
|
234 |
perl's ''unlink()'' function instead (as an |
|
|
235 |
optimization). The ; must be passed as a distinct |
|
|
236 |
argument, so it may need to be surrounded by whitespace |
|
|
237 |
and/or quoted from interpretation by the shell using a |
|
|
238 |
backslash (just as with using |
|
|
239 |
find(1)). |
|
|
240 |
|
|
|
241 |
|
|
|
242 |
-ok OPTIONS ; |
|
|
243 |
|
|
|
244 |
|
|
|
245 |
Like -exec, but first prompts user; if user's response does |
|
|
246 |
not begin with a y, skip the exec. The ; must be |
|
|
247 |
passed as a distinct argument, so it may need to be |
|
|
248 |
surrounded by whitespace and/or quoted from interpretation |
|
|
249 |
by the shell using a backslash (just as with using |
|
|
250 |
find(1)). |
|
|
251 |
|
|
|
252 |
|
|
|
253 |
-eval EXPR |
|
|
254 |
|
|
|
255 |
|
|
|
256 |
Has the perl script ''eval()'' the EXPR |
|
|
257 |
. |
|
|
258 |
|
|
|
259 |
|
|
|
260 |
-ls |
|
|
261 |
|
|
|
262 |
|
|
|
263 |
Simulates -exec ls -dils {} ; |
|
|
264 |
|
|
|
265 |
|
|
|
266 |
-tar FILE |
|
|
267 |
|
|
|
268 |
|
|
|
269 |
Adds current output to tar-format FILE |
|
|
270 |
. |
|
|
271 |
|
|
|
272 |
|
|
|
273 |
-cpio FILE |
|
|
274 |
|
|
|
275 |
|
|
|
276 |
Adds current output to old-style cpio-format |
|
|
277 |
FILE . |
|
|
278 |
|
|
|
279 |
|
|
|
280 |
-ncpio FILE |
|
|
281 |
|
|
|
282 |
|
|
|
283 |
Adds current output to ``new''-style cpio-format |
|
|
284 |
FILE . |
|
|
285 |
|
|
|
286 |
|
|
|
287 |
Predicates which take a numeric argument N can come in three |
|
|
288 |
forms: |
|
|
289 |
|
|
|
290 |
|
|
|
291 |
* N is prefixed with a +: match values greater than N |
|
|
292 |
* N is prefixed with a -: match values less than N |
|
|
293 |
* N is not prefixed with either + or -: match only values equal to N |
|
|
294 |
!!SEE ALSO |
|
|
295 |
|
|
|
296 |
|
|
|
297 |
find |
|
|
298 |
---- |