Forgive me if I slip up ... this line from the code example below: $result_array =a rray();
There should be no space in the word array(); Should look like this: $result_array = array(); ** sorry about that !! Some other fixes too .... here's the code again: ---------------------------- <snip> function list_dir($dirname) { $result_array = array(); $handle = opendir( $dirname ); while ( $file = readdir( $handle ) ) { if( $file == '.' || $file == '..' ) continue; if( is_dir( "$dirname\\$file" ) ) { list_dir( "$dirname\\$file" ); ## recursion; gets subdirectories } else { $result_array[] = "$dirname\\$file"; } } closedir($handle); return $result_array; } </snip> --------------------------------------------------------- -nicole www.aeontrek.com "Nicole Amashta" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I suggest checking the php.net site for doing this. You can use their search > box to search on particular subjects of PHP. For example, what you want to > do involves files and directories. YOu want to read from a directory and > list the files. So, on php.net, in the search box, you can type: dir and it > will take you to the appropriate documentation (of course, you may not > already know that, so you can't find the documention. > > Anyway, here's a link to useing directories: > http://www.php.net/manual/en/ref.dir.php > > and if you want to deal directly with files, here's a link for doing that: > http://www.php.net/manual/en/function.file.php > > Below is sample code I just copied and pasted, and slightly modified, from > the 1st link. It's an example of listing the files in a directory and > returning them in an array. > > ====================================== > ## $dirname is the path of the directory you want to list files from. > > function list_dir($dirname) > { > $result_array =a rray(); > $handle = opendir( $dirname ); > > while ( $file = readdir( $handle ) ) > { > if( $file == '.' || $file == '..' ) > continue; > > if( is_dir( $dirname.$file ) ) { > list_dir( $dirname.$file ); ## recursion; gets subdirectories > } > else { > $result_array[] = $dirname.$file; > } > } > > closedir($handle); > > return $result_array; > > } > > > ================================ > > "George Pitcher" <[EMAIL PROTECTED]> wrote in message > 027c01c1b091$0214ab20$630db092@HLATITUDE">news:027c01c1b091$0214ab20$630db092@HLATITUDE... > > Hi all, > > > > I want to build a list of filenames from a particular directory. I can't > > find anything like this in the manual or on the list archive so any > pointers > > would be appreciated. > > > > George > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php