nocvsdir.php

Go to the documentation of this file.
00001 <?php
00002 
00015 if ($argc < 2) {
00016     echo <<<EOF
00017 Usage: php ${_SERVER['PHP_SELF']} <path>
00018 
00019 Show the directory and all it's contents without any CVS directory in <path>.
00020 
00021 <path> The directory for which to generate the directory.
00022 
00023 
00024 EOF;
00025     exit(1);
00026 }
00027 
00028 if (!class_exists("RecursiveFilterIterator")) require_once("recursivefilteriterator.inc");
00029 
00030 class NoCvsDirectory extends RecursiveFilterIterator
00031 {
00032     function __construct($path)
00033     {
00034         parent::__construct(new RecursiveDirectoryIterator($path));
00035     }
00036 
00037     function accept()
00038     {
00039         return $this->getInnerIterator()->getFilename() != 'CVS';
00040     }
00041 
00042     function getChildren()
00043     {
00044         return new NoCvsDirectory($this->key());
00045     }
00046 }
00047 
00048 $it = new RecursiveIteratorIterator(new NoCvsDirectory($argv[1]));
00049 
00050 foreach($it as $pathname => $file)
00051 {
00052     echo $pathname."\n";
00053 }
00054 
00055 ?>

Generated on Thu Apr 26 01:04:47 2007 for SPL-StandardPHPLibrary by  doxygen 1.5.2