function findMusic($dir) { $musicList = array(); $dirHandle = opendir($dir); while (($file = readdir($dirHandle)) !== FALSE) { echo "
\n$file"; echo "
\n $dir"; if ($file == "." || $file == "..") continue; if (is_dir($dir . "/" . $file)) { echo "
full dir \n $dir \n $file "; if(is_link($dir) || (is_link($file))) { echo "
symlink found , ignoring symlink!!!"; echo "
$dir./$file \n is a symlink"; echo "
Symlink found on \n $file in \n $dir"; } else { $musicList=array_merge($musicList, findMusic($dir . "/" . $file)); } } $extension = end(explode(chr(46), $file)); // print $extension; if(is_link($file)) { echo "
file is a symlink"; } else { if (strtolower($extension) == "mp3") { $musicList[] = $dir . "/" . $file; } } } closedir($dirHandle); return $musicList; }