SPL-StandardPHPLibrary
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
examples
nocvsdir.php
Go to the documentation of this file.
1
<?php
2
15
if
($argc < 2) {
16
echo <<<EOF
17
Usage: php ${_SERVER[
'PHP_SELF'
]} <path>
18
19
Show the directory and all it
's contents without any CVS directory in <path>.
20
21
<path> The directory for which to generate the directory.
22
23
24
EOF;
25
exit(1);
26
}
27
28
if (!class_exists("RecursiveFilterIterator")) require_once("recursivefilteriterator.inc");
29
30
class NoCvsDirectory extends RecursiveFilterIterator
31
{
32
function __construct($path)
33
{
34
parent::__construct(new RecursiveDirectoryIterator($path));
35
}
36
37
function accept()
38
{
39
return $this->getInnerIterator()->getFilename() != '
CVS
';
40
}
41
42
function getChildren()
43
{
44
return new NoCvsDirectory($this->key());
45
}
46
}
47
48
$it = new RecursiveIteratorIterator(new NoCvsDirectory($argv[1]));
49
50
foreach($it as $pathname => $file)
51
{
52
echo $pathname."\n";
53
}
54
55
?>
Generated on Wed Dec 4 2013 21:25:51 for SPL-StandardPHPLibrary by
1.8.5