note 74504 added to function.opendir

From: Date: Sat, 14 Apr 2007 17:13:23 +0000
Subject: note 74504 added to function.opendir
Groups: php.notes 
Request: Send a blank email to php-notes+get-125398@lists.php.net to get a copy of this message
This is a script that prints all the file and directory names on your server no matter where the script file is located (could take a lot of time to execute, if you have a lot of directories and files...) Hope someone finds it useful... <?php print $_SERVER['DOCUMENT_ROOT'] . "<br />"; $root = @opendir($_SERVER['DOCUMENT_ROOT']); $dirs = array(); while($file = readdir($root)){ print $file; if((is_dir($file) || !stristr($file, ".")) && $file!="." && $file!=".."){ $dirs[] = ($_SERVER['DOCUMENT_ROOT'] . "/" . $file); print "(adding directory)"; } print "<br />"; } closedir($root); print "<br /><br />Inside Dirs: (" . (count($dirs)) . ")<br />"; $i = 0; while($i < count($dirs)){ $d = @opendir($dirs[$i]); print "<br /><br />Directory: " . $dirs[$i] . "<br />"; while($f = readdir($d)){ print $f; if((is_dir($f) || !stristr($f, ".")) && $f!="." && $f!=".."){ $dirs[] = $dirs[$i] . "/" . $f; print "(adding directory)"; } print "<br />"; } closedir($d); $i = $i + 1; } $i = $i - 1; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 87.120.68.77 ---- Manual Page -- http://www.php.net/manual/en/function.opendir.php Edit -- https://master.php.net/note/edit/74504 Del: integrated -- https://master.php.net/note/delete/74504/integrated Del: useless -- https://master.php.net/note/delete/74504/useless Del: bad code -- https://master.php.net/note/delete/74504/bad+code Del: spam -- https://master.php.net/note/delete/74504/spam Del: non-english -- https://master.php.net/note/delete/74504/non-english Del: in docs -- https://master.php.net/note/delete/74504/in+docs Del: other reasons-- https://master.php.net/note/delete/74504 Reject -- https://master.php.net/note/reject/74504 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125398) next »