Re: [PHP] getting filenames from dir

2005-04-01 Thread Mario St-Gelais
That should get you started : $dirname='/var'; $dh=opendir($dirname) or die('could not open directory'); while (!(($file=readdir($dh))===false)){ if (is_dir('$dirname/$file')){ $myarray[]=$file; } echo "$file"; $myarray[]=$file; } Mario Merlin wrote: Hi there, does anybody know h

Re: [PHP] getting filenames from dir

2005-04-01 Thread Vaibhav Sibal
Example 2. List all files in the current > directory and strip out . and .. > > if ($handle = opendir('.')) { >while (false !== ($file = readdir($handle))) { >if ($file != "." && $file != "..") { >echo "$file\n"

RE: [PHP] getting filenames from dir

2005-04-01 Thread Stanislav Kuhn
mply strip them out: Example 2. List all files in the current directory and strip out . and .. -Original Message- From: Merlin [mailto:[EMAIL PROTECTED] Sent: 01 April 2005 12:32 To: php-general@lists.php.net Subject: [PHP] getting filenames from dir Hi there, does anybody know ho

Re: [PHP] getting filenames from dir

2005-04-01 Thread Jesper Goos
Try this function: function scandir($dirstr){ $files = array(); $fh = opendir($dirstr); while (false !== ($filename = readdir($fh))){ array_push($files, $filename);} closedir($fh); return $files; } return an array with all th

[PHP] getting filenames from dir

2005-04-01 Thread Merlin
Hi there, does anybody know how to get all file names from a specified directory into an array? Thanx, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php