<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
require 'class.file_system_parser.php';
if ($_SERVER['argc'] > 1) {
$param = $_SERVER['argv'][1];
$parser = new FileSystemParser($param, true);
$parser->beginParse();
$results = $parser->setResults(true);
echo 'Dirs: ' . $results['dir_count'] . PHP_EOL;
echo 'Files: ' . $results['file_count'] . PHP_EOL;
echo 'Links: ' . $results['link_count'] . PHP_EOL;
echo "-------------------" . PHP_EOL;
echo 'Dirs: ' . PHP_EOL . join(PHP_EOL, $results['dirs']) . PHP_EOL . PHP_EOL;
echo 'Files: ' . PHP_EOL . join(PHP_EOL, $results['files']) . PHP_EOL . PHP_EOL;
echo 'Links: ' . PHP_EOL;
foreach($results['links'] as $link => $target) {
echo $link . ' -> ' . $target . PHP_EOL;
}
echo PHP_EOL . PHP_EOL;
} else {
die('No directory to parse.');
}
?>
|