php-src/ext/spl/examples/tree.php

33 lines
685 B
PHP
Raw Normal View History

2003-07-16 18:47:26 +00:00
<?php
2003-11-22 20:51:15 +00:00
/** tree view example
2003-07-16 18:47:26 +00:00
*
2003-12-04 19:39:46 +00:00
* Usage: php tree.php <path>
2003-07-16 18:47:26 +00:00
*
* Simply specify the path to tree with parameter <path>.
*
2003-12-04 19:39:46 +00:00
* (c) Marcus Boerger, 2003
2003-07-16 18:47:26 +00:00
*/
2003-12-04 19:39:46 +00:00
// The following line only operates on classes which are converted to c already.
// But does not generate a graphical output.
//foreach(new RecursiveIteratorIterator(new ParentIterator(new RecursiveDirectoryIterator($argv[1])), 1) as $file) {
if ($argc < 2) {
echo <<<EOF
Usage: php ${_SERVER['PHP_SELF']} <path>
Displays a graphical tree for the given <path>.
<path> The directory for which to generate the tree graph.
EOF;
exit(1);
}
2003-11-22 20:51:15 +00:00
foreach(new DirectoryGraphIterator($argv[1]) as $file) {
echo $file . "\n";
2003-07-16 18:47:26 +00:00
}
?>