Hey, I made this little script, quiet useful on windows and unix machines, but i have
a problem, division isn't returning a float, it just returns 0, would i need to do
something like convert $totalsize into a float?
<html>
<body><?php
$SecondsToTimeout = 120;
ini_alter(max_execution_time, $SecondsToTimeout);
function convert($bytes)
{
$kbytes = $bytes / 1024;
$mbytes = $kbytes / 1024;
$gbytes = $mbytes / 1024;
$tbytes = $gbytes / 1024;
return $mbyte;
}
function showdir($dir)
{
echo "<blockquote>";
$handle = opendir($dir);
while (false!==($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
if(is_file($dir."/".$file)){
// Commented out for fixing this error
// echo $file." (<i>".filesize($dir."/".$file)."
Bytes</i>)(<i>".filetype($dir."/".$file)."</i>)(<i>".fileperms($dir."/".$file)."</i>)<br>\n";
}
if(is_dir($dir."/".$file)){
$dirhandle = opendir($dir."/".$file);
while(false!==($filetocheck=readdir($dirhandle))){
if(!isset($totalsize))
$totalsize = filesize($dir."/".$file."/".$filetocheck);
else
$totalsize = $totalsize + filesize($dir."/".$file."/".$filetocheck);
}
echo $file." (<i>".convert($totalsize)."</i>)<br>\n";
showdir($dir.".".$file); // Put / on unix, and c:/ on windows
}
}
}
echo "</blockquote>";
}
showdir("/");
ini_restore(max_execution_time);
?></body></html>