[thelist] PHP- get list of files in directory?

Rick den Haan rick.denhaan at gmail.com
Tue Mar 13 09:57:13 CDT 2007

Stephen Rider wrote:
> Is there a way to get a list of files in a particular directory
> using PHP?  I would preferably like to end up with an array
> containing the name of each file found.


Take a look at example 485 on the PHP website for the readdir() function[1].
If you modify the fourth line to store the filename in an array instead of
echoing it, you're all set.


[1]: http://www.php.net/readdir

More information about the thelist mailing list