listing folders and files issue
Posted: Mon Jun 12, 2006 9:50 am
I am using following code for lising all files and folders in a specfic folder or directory.
i want to list folders and files in "abc" only, and then when i pass abc's child folder it should show me its files and folders.
how can i stop it when it has shown me foders and files in abc?
Code: Select all
<?
function read_dir($dir) {
$array = array();
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if($entry!='.' && $entry!='..') {
$entry = $dir.'/'.$entry;
if(is_dir($entry)) {
$array[] = $entry;
$array = array_merge($array, read_dir($entry));
} else {
$array[] = $entry;
}
}
}
$d->close();
return $array;
}
$abc = array();
$abc = read_dir("abc");
?>how can i stop it when it has shown me foders and files in abc?