|
Recursive scan of a folder with php |
|
|
|
Monday, 24 September 2007 |
function read_my_dir($dir)
{
global $tfile,$tdir;$i=0;$j=0;$myfiles;
$myfiles[][] = array();
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file=readdir($dh)) !== false)
{
if (!is_dir($dir.?\?.$file))
{
$tfile[$i]=$file;
$i++;
echo $dir.?\?.$file.? - <b>File</b>
?;
}
else
{
if (($file != ?.?) && ($file != ?..?))
{
$tdir[$j]=$file;
echo $dir.?\?.$file.? - <b>Directory</b>
?;
//$sep = ?\\?;
read_my_dir($dir.?\?.$file);
$j++;
}
}
}
closedir($dh);
}
}
}
|
|
Last Updated ( Monday, 24 September 2007 )
|