I don't know if there's a built-in function, but I had written this function, which does what you're trying to do, I think. You can modify it to store the values in an array, if you like. I just have it echoing the files (with their full paths).

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



Reply via email to