note 62079 added to function.readdir

From: Date: Sun, 19 Feb 2006 09:02:42 +0000
Subject: note 62079 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-104011@lists.php.net to get a copy of this message
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. ---- Server IP: 66.207.199.35 Probable Submitter: 70.26.23.51 ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62079 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62079&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62079&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104011) next »