Re: file_exists() to search for *.xml file with a wild card???
| From: | Matt M. | Date: | Tue, 20 Jul 2004 20:56:27 +0000 |
| Subject: | Re: file_exists() to search for *.xml file with a wild card??? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191234@lists.php.net to get a copy of this message | ||
> 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);
}
?>