note 64613 deleted from function.readdir by tularis

From: Date: Sun, 13 May 2007 19:00:49 +0000
Subject: note 64613 deleted from function.readdir by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126511@lists.php.net to get a copy of this message
Note Submitter: vorozhko at gmail dot com ---- Here is my recursive read dir function, what read dir by mask. [php] function ls($dir, $mask /*.php$|.txt$*/) { static $i = 0; $files = Array(); $d = opendir($dir); while ($file = readdir($d)) { if ($file == '.' || $file == '..' || eregi($mask, $file) ) continue; if (is_dir($dir.'/'.$file)) { $files += ls($dir.'/'.$file, $mask); continue; } $files[$i++] = $dir.'/'.$file; } return $files; } $f = ls('E:/www/mymoney/lsdu', ".php$" /*no spaces*/); [/php]

« previous php.notes (#126511) next »