[PHP] Print out all the files in a directory

2004-04-17 Thread Pooya Eslami
Hi, I want to write a simple script that looks for all the files with a common name and show them, like all the .mp3 files or all the .doc files. How do I go about it? Thank you, -Pooya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Matt Matijevich
http://www.php.net/readdir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Pooya Eslami
But how do I get all the .mp3 files? can I use *.mp3? and how ? Matt Matijevich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] http://www.php.net/readdir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Matt Matijevich
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; } }

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Pooya Eslami
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 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] on that page ther is examples ?php if ($handle = opendir('.')) { while (false

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Robert Cummings
On Sat, 2004-04-17 at 12:35, Pooya Eslami wrote: 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! if( eregi( '\.mp3$', $file ) ) Cheers, Rob. --

Re: [PHP] Print out all the files in a directory

2004-04-17 Thread Pooya Eslami
Thank you Robert. Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 2004-04-17 at 12:35, Pooya Eslami wrote: 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! if( eregi(