Basically I just took off truesize() (it doesn't exist
or you forgot to add it here), changed the quotes to my style (I mostly use single quotes). Not really a big change, imo. I did take off a / slash (it's commented).
I ran it in a big directory and gave me the correct bytes
code:
<?
function foldersize($folder){
if($handle = opendir($folder)) {
while (false !== ($file = readdir($handle))) {
if($file !='.' && $file !='' && $file != '..'){ // no / slash in $file != '../'
if(is_dir($folder.'/'.$file)){
$foldersize = $foldersize + foldersize($folder.'/'.$file);
}else{
$foldersize = $foldersize + filesize($folder.'/'.$file);
}
}
}
}
closedir($handle);
clearstatcache();
return $foldersize;
}
$total = foldersize('projects');
echo $total;
?>
Edit: took off the $temps.
Btw, when I started to reply to this thread it didn't have replies, but the preview page slowed me down.