SPL-StandardPHPLibrary
directorytree.php
Go to the documentation of this file.
1 <?php
2 
14 if ($argc < 2) {
15  echo <<<EOF
16 Usage: php ${_SERVER['PHP_SELF']} <path>
17 
18 Displays a graphical directory tree for the given <path>.
19 
20 <path> The directory for which to generate the directory tree graph.
21 
22 
23 EOF;
24  exit(1);
25 }
26 
27 if (!class_exists("DirectoryTreeIterator", false)) require_once("directorytreeiterator.inc");
28 
29 $length = $argc > 3 ? $argv[3] : -1;
30 
31 echo $argv[1]."\n";
32 foreach(new LimitIterator(new DirectoryTreeIterator($argv[1]), @$argv[2], $length) as $key=>$file) {
33 //foreach(new DirectoryTreeIterator($argv[1]) as $file) {
34  echo $file . "\n";
35 }
36 
37 ?>
Limited Iteration over another Iterator.
DirectoryIterator to generate ASCII graphic directory trees.
$length