bux23 of Micons
4/26/2017 - 10:40 AM

Find all files with specific extensions in directroy and subdirectories

Find all files with specific extensions in directroy and subdirectories

<?php

$extension = 'php';

$dir = new RecursiveDirectoryIterator('folder');
foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
    if ($file->isFile() && $file->getExtension() == $extension) {
        echo $file->getPathname() . "<br />";
    }
}

?>