|
1 <?xml version="1.0" encoding="ascii"?> |
|
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
3 "DTD/xhtml1-transitional.dtd"> |
|
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
5 <head> |
|
6 <title>fileutils.FileScanner</title> |
|
7 <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
|
8 <script type="text/javascript" src="epydoc.js"></script> |
|
9 </head> |
|
10 |
|
11 <body bgcolor="white" text="black" link="blue" vlink="#204080" |
|
12 alink="#204080"> |
|
13 <!-- ==================== NAVIGATION BAR ==================== --> |
|
14 <table class="navbar" border="0" width="100%" cellpadding="0" |
|
15 bgcolor="#a0c0ff" cellspacing="0"> |
|
16 <tr valign="middle"> |
|
17 |
|
18 <!-- Tree link --> |
|
19 <th> <a |
|
20 href="module-tree.html">Trees</a> </th> |
|
21 |
|
22 <!-- Index link --> |
|
23 <th> <a |
|
24 href="identifier-index.html">Indices</a> </th> |
|
25 |
|
26 <!-- Help link --> |
|
27 <th> <a |
|
28 href="help.html">Help</a> </th> |
|
29 |
|
30 <th class="navbar" width="100%"></th> |
|
31 </tr> |
|
32 </table> |
|
33 <table width="100%" cellpadding="0" cellspacing="0"> |
|
34 <tr valign="top"> |
|
35 <td width="100%"> |
|
36 <span class="breadcrumbs"> |
|
37 <a href="fileutils-module.html">Module fileutils</a> :: |
|
38 Class FileScanner |
|
39 </span> |
|
40 </td> |
|
41 <td> |
|
42 <table cellpadding="0" cellspacing="0"> |
|
43 <!-- hide/show private --> |
|
44 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
|
45 onclick="toggle_private();">hide private</a>]</span></td></tr> |
|
46 <tr><td align="right"><span class="options" |
|
47 >[<a href="frames.html" target="_top">frames</a |
|
48 >] | <a href="fileutils.FileScanner-class.html" |
|
49 target="_top">no frames</a>]</span></td></tr> |
|
50 </table> |
|
51 </td> |
|
52 </tr> |
|
53 </table> |
|
54 <!-- ==================== CLASS DESCRIPTION ==================== --> |
|
55 <h1 class="epydoc">Class FileScanner</h1><span class="codelink"><a href="fileutils-pysrc.html#FileScanner">source code</a></span><br /><br /> |
|
56 <pre class="base-tree"> |
|
57 object --+ |
|
58 | |
|
59 <a href="fileutils.AbstractScanner-class.html">AbstractScanner</a> --+ |
|
60 | |
|
61 <strong class="uidshort">FileScanner</strong> |
|
62 </pre> |
|
63 |
|
64 <hr /> |
|
65 <p>Scans the filesystem for files that match the selection paths.</p> |
|
66 <p>The scanner is configured with a root directory. Any number of include |
|
67 and exclude paths can be added. The scan() method is a generator that |
|
68 returns matching files one at a time when called as an iterator.</p> |
|
69 <p>This is a revisited implementation of the filescanner. It now relies on |
|
70 the module pathaddition.match that implements a Ant-like regular expression matcher.</p> |
|
71 <p>Rules: |
|
72 - Includes and excludes should not start with * |
|
73 - Includes and excludes should not have wildcard searches ending with ** (e.g. wildcard**)</p> |
|
74 <p>Supported includes and excludes: |
|
75 - filename.txt |
|
76 - filename.* |
|
77 - dir/ |
|
78 - dir/* |
|
79 - dir/**</p><br /><br /> |
|
80 |
|
81 <!-- ==================== INSTANCE METHODS ==================== --> |
|
82 <a name="section-InstanceMethods"></a> |
|
83 <table class="summary" border="1" cellpadding="3" |
|
84 cellspacing="0" width="100%" bgcolor="white"> |
|
85 <tr bgcolor="#70b0f0" class="table-header"> |
|
86 <td colspan="2" class="table-header"> |
|
87 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
88 <tr valign="top"> |
|
89 <td align="left"><span class="table-header">Instance Methods</span></td> |
|
90 <td align="right" valign="top" |
|
91 ><span class="options">[<a href="#section-InstanceMethods" |
|
92 class="privatelink" onclick="toggle_private();" |
|
93 >hide private</a>]</span></td> |
|
94 </tr> |
|
95 </table> |
|
96 </td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td width="15%" align="right" valign="top" class="summary"> |
|
100 <span class="summary-type"> </span> |
|
101 </td><td class="summary"> |
|
102 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
103 <tr> |
|
104 <td><span class="summary-sig"><a href="fileutils.FileScanner-class.html#__init__" class="summary-sig-name">__init__</a>(<span class="summary-sig-arg">self</span>, |
|
105 <span class="summary-sig-arg">root_dir</span>)</span><br /> |
|
106 Initialization.</td> |
|
107 <td align="right" valign="top"> |
|
108 <span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__init__">source code</a></span> |
|
109 |
|
110 </td> |
|
111 </tr> |
|
112 </table> |
|
113 |
|
114 </td> |
|
115 </tr> |
|
116 <tr> |
|
117 <td width="15%" align="right" valign="top" class="summary"> |
|
118 <span class="summary-type"> </span> |
|
119 </td><td class="summary"> |
|
120 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
121 <tr> |
|
122 <td><span class="summary-sig"><a href="fileutils.FileScanner-class.html#scan" class="summary-sig-name">scan</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
|
123 Scans the files required to zip</td> |
|
124 <td align="right" valign="top"> |
|
125 <span class="codelink"><a href="fileutils-pysrc.html#FileScanner.scan">source code</a></span> |
|
126 |
|
127 </td> |
|
128 </tr> |
|
129 </table> |
|
130 |
|
131 </td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td width="15%" align="right" valign="top" class="summary"> |
|
135 <span class="summary-type"> </span> |
|
136 </td><td class="summary"> |
|
137 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
138 <tr> |
|
139 <td><span class="summary-sig"><a href="fileutils.FileScanner-class.html#find_subroots" class="summary-sig-name">find_subroots</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
|
140 Finds all the subdirectory roots based on the include paths.</td> |
|
141 <td align="right" valign="top"> |
|
142 <span class="codelink"><a href="fileutils-pysrc.html#FileScanner.find_subroots">source code</a></span> |
|
143 |
|
144 </td> |
|
145 </tr> |
|
146 </table> |
|
147 |
|
148 </td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td width="15%" align="right" valign="top" class="summary"> |
|
152 <span class="summary-type"> </span> |
|
153 </td><td class="summary"> |
|
154 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
155 <tr> |
|
156 <td><span class="summary-sig"><a href="fileutils.FileScanner-class.html#__str__" class="summary-sig-name">__str__</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
|
157 Returns a string representing this instance.</td> |
|
158 <td align="right" valign="top"> |
|
159 <span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__str__">source code</a></span> |
|
160 |
|
161 </td> |
|
162 </tr> |
|
163 </table> |
|
164 |
|
165 </td> |
|
166 </tr> |
|
167 <tr> |
|
168 <td width="15%" align="right" valign="top" class="summary"> |
|
169 <span class="summary-type"> </span> |
|
170 </td><td class="summary"> |
|
171 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
172 <tr> |
|
173 <td><span class="summary-sig"><a href="fileutils.FileScanner-class.html#__repr__" class="summary-sig-name">__repr__</a>(<span class="summary-sig-arg">self</span>)</span><br /> |
|
174 Returns a string representing this instance.</td> |
|
175 <td align="right" valign="top"> |
|
176 <span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__repr__">source code</a></span> |
|
177 |
|
178 </td> |
|
179 </tr> |
|
180 </table> |
|
181 |
|
182 </td> |
|
183 </tr> |
|
184 <tr> |
|
185 <td colspan="2" class="summary"> |
|
186 <p class="indent-wrapped-lines"><b>Inherited from <code><a href="fileutils.AbstractScanner-class.html">AbstractScanner</a></code></b>: |
|
187 <code><a href="fileutils.AbstractScanner-class.html#add_exclude">add_exclude</a></code>, |
|
188 <code><a href="fileutils.AbstractScanner-class.html#add_exclude_file">add_exclude_file</a></code>, |
|
189 <code><a href="fileutils.AbstractScanner-class.html#add_filetype">add_filetype</a></code>, |
|
190 <code><a href="fileutils.AbstractScanner-class.html#add_include">add_include</a></code>, |
|
191 <code><a href="fileutils.AbstractScanner-class.html#add_selector">add_selector</a></code>, |
|
192 <code><a href="fileutils.AbstractScanner-class.html#is_excluded">is_excluded</a></code>, |
|
193 <code><a href="fileutils.AbstractScanner-class.html#is_filetype">is_filetype</a></code>, |
|
194 <code><a href="fileutils.AbstractScanner-class.html#is_included">is_included</a></code>, |
|
195 <code><a href="fileutils.AbstractScanner-class.html#is_selected">is_selected</a></code>, |
|
196 <code><a href="fileutils.AbstractScanner-class.html#match">match</a></code>, |
|
197 <code><a href="fileutils.AbstractScanner-class.html#test_path">test_path</a></code> |
|
198 </p> |
|
199 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
|
200 <code>__delattr__</code>, |
|
201 <code>__getattribute__</code>, |
|
202 <code>__hash__</code>, |
|
203 <code>__new__</code>, |
|
204 <code>__reduce__</code>, |
|
205 <code>__reduce_ex__</code>, |
|
206 <code>__setattr__</code> |
|
207 </p> |
|
208 </td> |
|
209 </tr> |
|
210 </table> |
|
211 <!-- ==================== PROPERTIES ==================== --> |
|
212 <a name="section-Properties"></a> |
|
213 <table class="summary" border="1" cellpadding="3" |
|
214 cellspacing="0" width="100%" bgcolor="white"> |
|
215 <tr bgcolor="#70b0f0" class="table-header"> |
|
216 <td colspan="2" class="table-header"> |
|
217 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
218 <tr valign="top"> |
|
219 <td align="left"><span class="table-header">Properties</span></td> |
|
220 <td align="right" valign="top" |
|
221 ><span class="options">[<a href="#section-Properties" |
|
222 class="privatelink" onclick="toggle_private();" |
|
223 >hide private</a>]</span></td> |
|
224 </tr> |
|
225 </table> |
|
226 </td> |
|
227 </tr> |
|
228 <tr> |
|
229 <td colspan="2" class="summary"> |
|
230 <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
|
231 <code>__class__</code> |
|
232 </p> |
|
233 </td> |
|
234 </tr> |
|
235 </table> |
|
236 <!-- ==================== METHOD DETAILS ==================== --> |
|
237 <a name="section-MethodDetails"></a> |
|
238 <table class="details" border="1" cellpadding="3" |
|
239 cellspacing="0" width="100%" bgcolor="white"> |
|
240 <tr bgcolor="#70b0f0" class="table-header"> |
|
241 <td colspan="2" class="table-header"> |
|
242 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
243 <tr valign="top"> |
|
244 <td align="left"><span class="table-header">Method Details</span></td> |
|
245 <td align="right" valign="top" |
|
246 ><span class="options">[<a href="#section-MethodDetails" |
|
247 class="privatelink" onclick="toggle_private();" |
|
248 >hide private</a>]</span></td> |
|
249 </tr> |
|
250 </table> |
|
251 </td> |
|
252 </tr> |
|
253 </table> |
|
254 <a name="__init__"></a> |
|
255 <div> |
|
256 <table class="details" border="1" cellpadding="3" |
|
257 cellspacing="0" width="100%" bgcolor="white"> |
|
258 <tr><td> |
|
259 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
260 <tr valign="top"><td> |
|
261 <h3 class="epydoc"><span class="sig"><span class="sig-name">__init__</span>(<span class="sig-arg">self</span>, |
|
262 <span class="sig-arg">root_dir</span>)</span> |
|
263 <br /><em class="fname">(Constructor)</em> |
|
264 </h3> |
|
265 </td><td align="right" valign="top" |
|
266 ><span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__init__">source code</a></span> |
|
267 </td> |
|
268 </table> |
|
269 |
|
270 Initialization. |
|
271 <dl class="fields"> |
|
272 <dt>Overrides: |
|
273 <a href="fileutils.AbstractScanner-class.html#__init__">AbstractScanner.__init__</a> |
|
274 </dt> |
|
275 </dl> |
|
276 </td></tr></table> |
|
277 </div> |
|
278 <a name="scan"></a> |
|
279 <div> |
|
280 <table class="details" border="1" cellpadding="3" |
|
281 cellspacing="0" width="100%" bgcolor="white"> |
|
282 <tr><td> |
|
283 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
284 <tr valign="top"><td> |
|
285 <h3 class="epydoc"><span class="sig"><span class="sig-name">scan</span>(<span class="sig-arg">self</span>)</span> |
|
286 </h3> |
|
287 </td><td align="right" valign="top" |
|
288 ><span class="codelink"><a href="fileutils-pysrc.html#FileScanner.scan">source code</a></span> |
|
289 </td> |
|
290 </table> |
|
291 |
|
292 Scans the files required to zip |
|
293 <dl class="fields"> |
|
294 <dt>Overrides: |
|
295 <a href="fileutils.AbstractScanner-class.html#scan">AbstractScanner.scan</a> |
|
296 </dt> |
|
297 </dl> |
|
298 </td></tr></table> |
|
299 </div> |
|
300 <a name="find_subroots"></a> |
|
301 <div> |
|
302 <table class="details" border="1" cellpadding="3" |
|
303 cellspacing="0" width="100%" bgcolor="white"> |
|
304 <tr><td> |
|
305 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
306 <tr valign="top"><td> |
|
307 <h3 class="epydoc"><span class="sig"><span class="sig-name">find_subroots</span>(<span class="sig-arg">self</span>)</span> |
|
308 </h3> |
|
309 </td><td align="right" valign="top" |
|
310 ><span class="codelink"><a href="fileutils-pysrc.html#FileScanner.find_subroots">source code</a></span> |
|
311 </td> |
|
312 </table> |
|
313 |
|
314 <p>Finds all the subdirectory roots based on the include paths.</p> |
|
315 <p>Often large archive operations define a number of archives from the root |
|
316 of the drive. Walking the tree from the root is very time-consuming, so |
|
317 selecting more specific subdirectory roots improves performance.</p> |
|
318 <dl class="fields"> |
|
319 </dl> |
|
320 </td></tr></table> |
|
321 </div> |
|
322 <a name="__str__"></a> |
|
323 <div> |
|
324 <table class="details" border="1" cellpadding="3" |
|
325 cellspacing="0" width="100%" bgcolor="white"> |
|
326 <tr><td> |
|
327 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
328 <tr valign="top"><td> |
|
329 <h3 class="epydoc"><span class="sig"><span class="sig-name">__str__</span>(<span class="sig-arg">self</span>)</span> |
|
330 <br /><em class="fname">(Informal representation operator)</em> |
|
331 </h3> |
|
332 </td><td align="right" valign="top" |
|
333 ><span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__str__">source code</a></span> |
|
334 </td> |
|
335 </table> |
|
336 |
|
337 Returns a string representing this instance. |
|
338 <dl class="fields"> |
|
339 <dt>Overrides: |
|
340 <a href="fileutils.AbstractScanner-class.html#__str__">AbstractScanner.__str__</a> |
|
341 <dd><em class="note">(inherited documentation)</em></dd> |
|
342 </dt> |
|
343 </dl> |
|
344 </td></tr></table> |
|
345 </div> |
|
346 <a name="__repr__"></a> |
|
347 <div> |
|
348 <table class="details" border="1" cellpadding="3" |
|
349 cellspacing="0" width="100%" bgcolor="white"> |
|
350 <tr><td> |
|
351 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
352 <tr valign="top"><td> |
|
353 <h3 class="epydoc"><span class="sig"><span class="sig-name">__repr__</span>(<span class="sig-arg">self</span>)</span> |
|
354 <br /><em class="fname">(Representation operator)</em> |
|
355 </h3> |
|
356 </td><td align="right" valign="top" |
|
357 ><span class="codelink"><a href="fileutils-pysrc.html#FileScanner.__repr__">source code</a></span> |
|
358 </td> |
|
359 </table> |
|
360 |
|
361 Returns a string representing this instance. |
|
362 <dl class="fields"> |
|
363 <dt>Overrides: |
|
364 <a href="fileutils.AbstractScanner-class.html#__repr__">AbstractScanner.__repr__</a> |
|
365 <dd><em class="note">(inherited documentation)</em></dd> |
|
366 </dt> |
|
367 </dl> |
|
368 </td></tr></table> |
|
369 </div> |
|
370 <br /> |
|
371 <!-- ==================== NAVIGATION BAR ==================== --> |
|
372 <table class="navbar" border="0" width="100%" cellpadding="0" |
|
373 bgcolor="#a0c0ff" cellspacing="0"> |
|
374 <tr valign="middle"> |
|
375 |
|
376 <!-- Tree link --> |
|
377 <th> <a |
|
378 href="module-tree.html">Trees</a> </th> |
|
379 |
|
380 <!-- Index link --> |
|
381 <th> <a |
|
382 href="identifier-index.html">Indices</a> </th> |
|
383 |
|
384 <!-- Help link --> |
|
385 <th> <a |
|
386 href="help.html">Help</a> </th> |
|
387 |
|
388 <th class="navbar" width="100%"></th> |
|
389 </tr> |
|
390 </table> |
|
391 <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
|
392 <tr> |
|
393 <td align="left" class="footer"> |
|
394 Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:18 2009 |
|
395 </td> |
|
396 <td align="right" class="footer"> |
|
397 <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a> |
|
398 </td> |
|
399 </tr> |
|
400 </table> |
|
401 |
|
402 <script type="text/javascript"> |
|
403 <!-- |
|
404 // Private objects are initially displayed (because if |
|
405 // javascript is turned off then we want them to be |
|
406 // visible); but by default, we want to hide them. So hide |
|
407 // them unless we have a cookie that says to show them. |
|
408 checkCookie() |
|
409 // --> |
|
410 </script> |
|
411 |
|
412 </body> |
|
413 </html> |