array
&File_Find::maptree (
string $directory
)
Map the directory tree given by the directory_path parameter.
string $directory
- contains the directory
path that you want to map
array
- a two element array, the first
element containing a list of all the directories, the second
element containing a list of all the files.
This function can be called statically.
Get the map of a directory
<?php
include "File/Find.php";
$dir = "File_Find";
list($directories, $files) = File_Find::maptree($dir);
echo "Directories ";
print_r($directories);
echo "Files ";
print_r($files);
?>
The above example will output something similar to:
Directories Array
(
[0] => File_Find
[1] => File_Find\dir2
[2] => File_Find\dir2\2
[3] => File_Find\dir2\1
[4] => File_Find\dir2\0
[5] => File_Find\dir
[6] => File_Find\dir\txtdir
[7] => File_Find\dir\dir3
[8] => File_Find\dir\dir2
)
Files Array
(
[0] => File_Find\dir2\2\1.txt
[1] => File_Find\dir2\1\1.txt
[2] => File_Find\dir2\0\1.txt
[3] => File_Find\dir\1.txt
[4] => File_Find\dir\2.txt
[5] => File_Find\dir\txtdir\5.txt
[6] => File_Find\dir\dir3\4.bak
[7] => File_Find\dir\dir3\4.txt
[8] => File_Find\dir\dir2\3.bak
[9] => File_Find\dir\dir2\3.txt
)