prova così
Codice PHP:
<?php
while(list($key, $value) = each($dirs)) {
$d++;
//Controllo Ultima Modifica dir
$last_time_modified = filemtime($value);
$mod = date("j/m/y h:i", $last_time_modified);
//Controlli Grandezza Dir
$sized=(is_dir($value))?dirSize($value):filesize($value);
$bytesd = $sized;
$kbytesd = $bytesd/1024;
$mbytesd = $kbytesd/(1024*1024);
$round = round($kbytesd, 2);
echo "<tr class=\"light_row\">
<td class=\"autoindex_td\">
<img src=\"graphics/icon/dir.png\" /><input type=\"checkbox\" name=\"rd\" onclick=\"if(this.checked){if(confirm('Cancellare la cartella: $value e tutto il suo contenuto?')){location.href='rd.php?rd=$directory$value'}}\" />
<a id=\"fb\" href=\"index.php?dir=$directory$value/\">$value</a>
</td>
<td class=\"autoindex_td_right\"><span id=\"fb\">$round KB</span></td>
<td class=\"autoindex_td_right\"><span id=\"fb\">$mod</span></td></tr>";
}
echo "<tr><th class=\"autoindex_th\">Files</th>
<th class=\"autoindex_th\"></th>
<th class=\"autoindex_th\"></th></tr>";
/**
* Get the directory size
* @param directory $directory
* @return integer
*/
function dirSize($directory) {
$size = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){
$size+=$file->getSize();
}
return $size;
}
?>