note 62079 deleted from function.readdir by tularis

From: Date: Sun, 13 May 2007 19:01:30 +0000
Subject: note 62079 deleted from function.readdir by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126515@lists.php.net to get a copy of this message
Note Submitter: imran at imranaziz dot net ---- Based on tips above, I made this function that displays all php files in your whole website, like a tree. It also displays which directory they're in. $dir = $_SERVER['DOCUMENT_ROOT']; $shell_command = find $dir -depth -type f -print; $files = explode ("\n", $shell_command); foreach ($files as $value) { $fileInfo = pathinfo($value); $extension = $fileInfo["extension"]; if ($extension == "php") { $cur_dir = str_replace($_SERVER['DOCUMENT_ROOT'], "", dirname($value)); if ($cur_dir != $old_dir) { echo "<p><b>" . $cur_dir . "</b></p>"; $old_dir = $cur_dir; } echo $cur_dir . "/" . basename($value) . "<BR>"; } } You can change it to take input of certain directory or files of certain, or no extension.

« previous php.notes (#126515) next »