[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [kDev] Update and viewing php source code question...



At 15:49 24/06/2002 +0100, Daniel Harris wrote:
Nice one Joe! Now we need to find all .php and .inc files in web area (and any sub-directories). How do you do that?

This should do the trick:-

<?
function getDirList ($dirName) {

                $d = dir($dirName);
                while($entry = $d->read()) {
                        if ($entry != "." && $entry != "..") {
                                if (is_dir($dirName."/".$entry)) {
                                        getDirList($dirName."/".$entry);
                                } else {
if (substr($entry,-4)==".php" || substr($entry,-4)==".inc")
                                                echo $dirName."/".$entry."\n";
                                }
                        }
                }
                $d->close();
        }

        getDirList("/var/www/html");
?>