note 23390 deleted from function.readdir by tomsommer
| From: | tomsommer@php.net | Date: | Sun, 27 Jun 2004 13:13:18 +0000 |
| Subject: | note 23390 deleted from function.readdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71882@lists.php.net to get a copy of this message | ||
Note Submitter: kriho(at)passagen(dot)se
----
A little addition to the posting that used "find" to get a dir listing. It can easily be
incorporated with grep to get filenames ending with only... say jpg.
$dir="/directory/";
$a =
find $dir -depth -type f -print | grep ".jpg$";
$files = explode ("\n", $a);
As in the regexp example above the $ in ".jpg$" makes sure no .jpg.blaa extensions are
showed.
This works wonders for me :)