Here's the function:
function readDir ($dirPath)
{
if (is_dir($dirPath)) {
$fstream = opendir($dirPath);
while ($fentry = readdir($fstream)) {
if (is_dir("$dirPath/$fentry") && ($fentry != ".") && ($fentry != "..")) {
echo "$dirPath/$fentry";
readDir("$dirPath/$fentry");
} elseif (is_file("$dirPath/$fentry")) {
echo "$dirPath/$fentry";
}
}
closedir($fstream);
return true;
} else {
return false;
}
}
Hope this helps!
-Ben
Binay wrote:
Hi all,
is there function which scans a particual directory recurisly and stores the content in array or other way? Listing of files should be in alphabetical way and directories should come on top.
Thanks
Binay
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php