Re: file_exists() to search for *.xml file with a wild card???
| From: | Scott Fletcher | Date: | Tue, 20 Jul 2004 21:17:07 +0000 |
| Subject: | Re: file_exists() to search for *.xml file with a wild card??? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191235@lists.php.net to get a copy of this message | ||
I like this one, the readdir() function. It look very promising.
Thanks!!!!!
Scott F.
"Matt M." <h.dudeness@gmail.com> wrote in message
news:7d45802004072013564c82851a@mail.gmail.com...
> > I would like to use the file_exists() or something similar to check for
the
> > existance of any of the xml files regardless of what filename it use.
Like
> > file_exist("*.xml") for example..... Anyone know??
>
> http://us3.php.net/readdir
>
> <?php
> if ($handle = opendir('/path/to/files')) {
>
> while (false !== ($file = readdir($handle))) {
> $path_parts = pathinfo($file)
> if ($path_parts['extension'] == 'xml') {
> //xml file
> }
> }
> closedir($handle);
> }
> ?>