On Tue, 21 Aug 2001 12:35, Chris Aitken wrote:
> Hey all,
>
> Just something I havent been able to sort out in the archives, but what
> im wanting to do it this. Do a listing of all files in a directory, and
> load up an array with each returned filename.
>
> Am I pissing into a windy pipe dream or is there a simple solution for
> this ?
>
>
>
> Cheers
>

This, ever so slightly adapted from the example in the docs for readdir, 
should do what you want

<?php
$handle=opendir(’.’); // replace . with whatever
while (false!==($file = readdir($handle))) {
  if ($file != "." && $file != "..") {
    echo "$file\n";
    $file_ary[] = $file; //The extra bit:-)
  }
}
closedir($handle);
?>


-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   "My stereo's half-fixed," said Tom monotonously.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to