note 101654 added to class.recursivedirectoryiterator
| From: | antennen at osu1 dot php dot net | Date: | Sun, 02 Jan 2011 17:40:22 +0000 |
| Subject: | note 101654 added to class.recursivedirectoryiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175399@lists.php.net to get a copy of this message | ||
If you use RecursiveDirectoryIterator with RecursiveIteratorIterator and run into
UnexpectedValueException you may use this little hack to ignore those directories, such as
lost+found on linux.
<?php
class IgnorantRecursiveDirectoryIterator extends RecursiveDirectoryIterator {
function getChildren() {
try {
return parent::getChildren();
} catch(UnexpectedValueException $e) {
return new RecursiveArrayIterator(array());
}
}
}
?>
Use just like the normal RecursiveDirectoryIterator.
----
Server IP: 69.147.83.197
Probable Submitter: 79.136.61.42
----
Manual Page -- http://www.php.net/manual/en/class.recursivedirectoryiterator.php
Edit -- https://master.php.net/note/edit/101654
Del: integrated -- https://master.php.net/note/delete/101654/integrated
Del: useless -- https://master.php.net/note/delete/101654/useless
Del: bad code -- https://master.php.net/note/delete/101654/bad+code
Del: spam -- https://master.php.net/note/delete/101654/spam
Del: non-english -- https://master.php.net/note/delete/101654/non-english
Del: in docs -- https://master.php.net/note/delete/101654/in+docs
Del: other reasons-- https://master.php.net/note/delete/101654
Reject -- https://master.php.net/note/reject/101654
Search -- https://master.php.net/manage/user-notes.php