Module fileutils :: Class FileScanner |
[hide private]
[frames] | no frames]

# Class FileScanner

source code

         object --+
                  |
    AbstractScanner --+
                      |
                     FileScanner

Scans the filesystem for files that match the selection paths.

The scanner is configured with a root directory. Any number of include and exclude paths can be added. The scan() method is a generator that returns matching files one at a time when called as an iterator.

This is a revisited implementation of the filescanner. It now relies on the module pathaddition.match that implements a Ant-like regular expression matcher.

Rules: - Includes and excludes should not start with * - Includes and excludes should not have wildcard searches ending with ** (e.g. wildcard**)

Supported includes and excludes: - filename.txt - filename.* - dir/ - dir/* - dir/**

Instance Methods | [hide private]
__init__(self, root_dir) Initialization. | source code
scan(self) Scans the files required to zip | source code
find_subroots(self) Finds all the subdirectory roots based on the include paths. | source code
__str__(self) Returns a string representing this instance. | source code
__repr__(self) Returns a string representing this instance. | source code
Inherited from `AbstractScanner`: `add_exclude`, `add_exclude_file`, `add_filetype`, `add_include`, `add_selector`, `is_excluded`, `is_filetype`, `is_included`, `is_selected`, `match`, `test_path` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, root_dir) (Constructor) | source code
Initialization. Overrides: AbstractScanner.__init__

### scan(self) | source code
Scans the files required to zip Overrides: AbstractScanner.scan

### find_subroots(self) | source code
Finds all the subdirectory roots based on the include paths. Often large archive operations define a number of archives from the root of the drive. Walking the tree from the root is very time-consuming, so selecting more specific subdirectory roots improves performance.

### __str__(self) (Informal representation operator) | source code
Returns a string representing this instance. Overrides: AbstractScanner.__str__ (inherited documentation)

### __repr__(self) (Representation operator) | source code
Returns a string representing this instance. Overrides: AbstractScanner.__repr__ (inherited documentation)