File_Find::mapTreeMultiple() – create a recursive view map for a directory


require_once 'File/Find.php';

array &File_Find::mapTreeMultiple ( string $directory , integer $maxrecursion = 0 , integer $count = 0 )


Map the directory tree given by the directory_path parameter. Depending on maxrecursion you get the content of the directory and the content of the subdirectories too.


  • string $directory - contains the directory path that you want to map

  • integer $maxrecursion - defines the deep of recursive mapping of subdirectories

  • integer $count - can be ignored - internal parameter to track recursion level

Return value

array - a multidimensional array containing all subdirectories and their files


This function can be called statically.


Get the content of a directory including the content of subdirectories

include "File/Find.php";

$file File_Find::mapTreemultiple('/usr/'1);


The above example will output something similar to:

   [0] => file1.tmp
   [1] => file2.tmp
   ['bin'] => Array
         [0] => readme.txt
create a view map for a directory (Previous) find matches for a pattern in a directory (Next)
Last updated: Sun, 20 May 2018 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.