I'm trying to display a list of all folders inside of a directory. But I do not want any folders listed that contain the word "thumbs" in it. Can someone tell me how to do this... Here is the code I am using that doesn't seem to work. It displays all of the folders but it is not blocking the ones with the word "thumbs" in it.
<?php
$dir = new RecursiveDirectoryIterator('puzzle/images/puzzles/',
FilesystemIterator::SKIP_DOTS);
$it = new RecursiveIteratorIterator($dir,
RecursiveIteratorIterator::SELF_FIRST);
$it->setMaxDepth(1);
foreach ($it as $fileinfo) {
if ($fileinfo == '*thumbs') {
// PLACEHOLDER
} elseif ($fileinfo->isDir()) {
echo $fileinfo . "<br><br>";
}
}
?>
The output looks like this....
puzzle/images/puzzles/vehicles
puzzle/images/puzzles/vehicles/thumbs
puzzle/images/puzzles/scenery
puzzle/images/puzzles/scenery/thumbs
puzzle/images/puzzles/movies
puzzle/images/puzzles/movies/thumbs
puzzle/images/puzzles/thumbnails
puzzle/images/puzzles/holidays
puzzle/images/puzzles/holidays/thumbs
puzzle/images/puzzles/holidays/thanksgiving
This is what I want the output to look like except without the following folders...
puzzle/images/puzzles/vehicles/thumbs
puzzle/images/puzzles/scenery/thumbs
puzzle/images/puzzles/movies/thumbs
puzzle/images/puzzles/holidays/thumbs
Or any future folders with the name "thumbs" that I put in there later.