Re: Print out all the files in a directory
| From: | Pooya Eslami | Date: | Sat, 17 Apr 2004 16:35:16 +0000 |
| Subject: | Re: Print out all the files in a directory | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183719@lists.php.net to get a copy of this message | ||
That is exactly my question! how do I look for a .mp3 file?!
I tried
if ($file != "." && $file != ".." && $file=="*.mp3")
but it doesn't work!
"Matt Matijevich" <matijevich@alliancetechnologies.net> wrote in message
news:s08115da.000@NW0101DSM.ALLIANCETECHNOLOGIES.NET...
> on that page ther is examples
>
> <?php
> if ($handle = opendir('.')) {
> while (false !== ($file = readdir($handle))) {
> if ($file != "." && $file != "..") { //add your logic to see
> if
> it is an .mp3 file right here, that can be done any number of ways
> echo "$file\n";
> }
> }
> closedir($handle);
> }
> ?>