File
[ ]
[ ]
[ ]
[ ]
[ ]
The File component currently contains one class, providing a few handy
file system operations that are missing from PHP.
This example shows how to use the ezcFile::findRecursive() method:
1. <?php
2. require 'tutorial_autoload.php';
3.
4. $data = ezcFile::findRecursive(
5. "/dat/dev/ezcomponents",
6. array( '@src/.*_autoload.php$@' ),
7. array( '@/autoload/@' )
8. );
9. var_dump( $data );
10.
11. ?>
The code in this example searches for files in the /dat/dev/ezcomponents
directory. It will only include files that match all patterns in the
$includeFilters array (the second parameter). Files that match any of the
patterns in the $excludeFilters array (the third parameter) will not be returned.
In other words, the code above searches for files in the dat/dev/ezcomponents
directory, which are in the src/ directory and end with _autoload.php,
except for files that are in the /autoload/ directory.
This example shows how to use the ezcFile::removeRecursive() method:
1. <?php
2. require 'tutorial_autoload.php';
3.
4. ezcFile::removeRecursive( '/dat/dev/ezcomponents/trash' );
5.
6. ?>
This code simply removes the directory /dat/dev/ezcomponents/trash and all
of its files and sub-directories.
Warning: Use this function with care, as it has the potential to erase
everything that the current user has access to.
For more information, see the ezcFile API documentation.
Last updated: Thu, 01 Nov 2007