note 23535 added to function.readdir

From: Date: Sun, 21 Jul 2002 13:16:17 +0000
Subject: note 23535 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-33359@lists.php.net to get a copy of this message
I tried to find a script that would put all files of one directory($img_path) into an array while excluding any subdirectory, not only ".", ".." or "xyz". Chriss found the solution some threads above. The following way the slashes are used work for both- LINUX and WIN: $handle = opendir("$img_path"); while (false !== ($file = readdir($handle))) { if(is_file($img_path."//".$file)) { $filelist[] = $file; $anz_files = count($filelist); } } -- http://www.php.net/manual/en/function.readdir.php http://master.php.net/manage/user-notes.php?action=edit+23535 http://master.php.net/manage/user-notes.php?action=delete+23535 http://master.php.net/manage/user-notes.php?action=reject+23535

« previous php.notes (#33359) next »