PHP list of specific files in a directory
        Posted  
        
            by Jessica
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jessica
        
        
        
        Published on 2010-06-17T13:47:30Z
        Indexed on 
            2010/06/17
            13:53 UTC
        
        
        Read the original article
        Hit count: 262
        
The following code will list all the file in a directy
<?php
    if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle)))
    {
        if ($file != "." && $file != "..")
        {
            $thelist .= '<LI><a href="'.$file.'">'.$file.'</a>';
        }
    }
    closedir($handle);
    }
?>
<P>List of files:</p>
<UL>
<P><?=$thelist?></p>
</UL>
While this is very simple code it does it job.
I'm now looking for a way to list ONLY file that have .xml (or .XML) at the end, how do I do that?
Code is appreciate, thanks!
jess
© Stack Overflow or respective owner