note 51221 added to ref.dir

From: Date: Wed, 23 Mar 2005 19:17:06 +0000
Subject: note 51221 added to ref.dir
Groups: php.notes 
Request: Send a blank email to php-notes+get-86859@lists.php.net to get a copy of this message
Here is a very short function to return all files inside a dir with full pathname <?php //call the function $myfiles=GetDirContents(dirname($_SERVER['DOCUMENT_ROOT'])); ?> <?php // the function itself function GetDirContents($dir){ ini_set("max_execution_time",10); if (!is_dir($dir)){die ("Fehler in Funktion GetDirContents: kein gültiges Verzeichnis: $dir!");} if ($root=@opendir($dir)){ while ($file=readdir($root)){ if($file=="." || $file==".."){continue;} if(is_dir($dir."/".$file)){ $files=array_merge($files,GetDirContents($dir."/".$file)); }else{ $files[]=$dir."/".$file; } } } return $files; } ?> ---- Manual Page -- http://www.php.net/manual/en/ref.dir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51221 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51221&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51221&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51221&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51221&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51221&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51221&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86859) next »