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
And does one manage recursive sub directories for the same thing ? On Apr 1, 2005 3:38 AM, Stanislav Kuhn <[EMAIL PROTECTED]> wrote: > HI... > > Do you read php manual sometimes? ;o) > > just replace > echo "$file\n"; > by > $my_file_array[]=$file; > > readdir > (PHP 3, PHP 4 , PHP 5) > > read

RE: [PHP] getting filenames from dir

2005-04-01 Thread Stanislav Kuhn
HI... Do you read php manual sometimes? ;o) just replace echo "$file\n"; by $my_file_array[]=$file; readdir (PHP 3, PHP 4 , PHP 5) readdir -- read entry from directory handle Description string readdir ( resource dir_handle) Returns the filename of the next file from the directory. The filen

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