Php file scan help

Hi again my action script file loads an XML file, dynamically created with PHP and php scans the mp3/a directory and creats list files and folders in tree component of flash using as script.

its scans mp3/a/ dir and folders and files in it(mp3/a/50z/candyshop.mp3) but if e.g. i have mp3/a/50z/2005 album/indaclub.mp3 it doesnot scun it. can someone modifi this script?i whant to scan with it mp3/a/50z/ subfolders and sub files too.can someone do this? thanks :slight_smile:

here is php script

<?php
$dir = "mp3/a/";



echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
";
echo "<music>
";

// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
         $subdir = $file;         
         if ($subdir != "." && $subdir != ".." && $subdir != "_notes") {
            echo "<artist label=\"$subdir\" >
";
            //Scan the subdirectories
            if ($sh = opendir($dir . $subdir."/")) {
               while (($sfile = readdir($sh)) !== false) {
               if ($sfile != "." && $sfile != "..") {
                 $subfile = $sfile;
                     echo "<song url=\"$dir$subdir/$subfile\" label=\"" . $subfile . "\" />
";  
                  
                  }
                  
               }
               closedir($sh);
            
            }
            echo "</artist>
";         
         
         }         
         
        }
        closedir($dh);
    } 
}
echo "</music>"
?>