note 36471 deleted from ref.dir by sniper

From: Date: Fri, 16 Dec 2005 00:00:11 +0000
Subject: note 36471 deleted from ref.dir by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100256@lists.php.net to get a copy of this message
Note Submitter: ---- get a list of files and directories recursivelly without the use of global variables. the difference between this one and piccaso at gmx dot net's, is that this one returns files inside the subdirectories as well (with full path) : function recursive_listdir($base) { static $filelist = array(); static $dirlist = array(); if(is_dir($base)) { $dh = opendir($base); while (false !== ($dir = readdir($dh))) { if (is_dir($base ."/". $dir) && $dir !== '.' && $dir !== '..') { $subbase = $base ."/". $dir; $dirlist[] = $subbase; $subdirlist = recursive_listdir($subbase); } elseif(is_file($base ."/". $dir) && $dir !== '.' && $dir !== '..') { $filelist[] = $base ."/". $dir; } } closedir($dh); } $array['dirs'] = $dirlist; $array['files'] = $filelist; return $array; }

« previous php.notes (#100256) next »