Writers | Archive modification |
File_Archive | |
PEAR Manual | |
File_Archive introduces the concept of filters to be able to select the files from a source. A filter is a particular reader that you can create with the File_Archive::filter() function. This function requires you to give a predicate. You can build this predicate using the File_Archive::pred* functions.
The standard logic predicates are:
predTrue(): always evaluates to true
predFalse(): always evaluates to false
predAnd($p1, $p2, ...): evaluates to $p1 && $p2 && ...
predOr($p1, $p2, ...): evaluates to $p1 || $p2 || ...
predNot($p): evaluates to !$p
Some other predicats will help you filtering the files:
predMinSize($size): keep only the files which size is >= $size (in bytes).
predMinTime($time): keep only the files that have been modified after $time (unix timestamp).
predMaxDepth($depth): keep only the files that have a public name with less than $depth directories.
predExtension($list): keep only the files with a given extension. $list is an array or a comma separated string of allowed extensions.
predEreg($ereg): keep only the files that have a public name that matches the given regular expression.
predEregi($ereg): same as predEreg(), but the test is case insensitive.
predMIME($mimes): Select files with a certain MIME type. You can pass an array of types or a string, and use wildcards.
Filter examples
|
Writers | Archive modification |
File_Archive | |
PEAR Manual | |