Codice PHP:
<?
$total = 0;
$a = 0;
function scan_dir($file)
{
global $total, $a;
$handle = opendir($file);
while($read = readdir($handle))
{
if($read != '.' && $read != '..')
{
if( is_file($file . '/' . $read) )
{
$total += filesize($file . '/' . $read);
echo "{$file}/{$read} - <b>" . number_format(filesize($file . '/' . $read), 0, '.', ' ') . "</b><br>\n";
$a++;
}
elseif( is_dir($file . '/' . $read) )
{
scan_dir($file . '/' . $read);
}
}
}
closedir($handle);
}
if($handle = opendir('.'))
{
while($file = readdir($handle))
{
if($file != '.' && $file != '..' && is_file($file))
{
$total += filesize($file);
echo "$file - <b>" . number_format(filesize($file), 0, '.', ' ') . "</b><br>\n";
$a++;
}
elseif( is_dir($file) !== false )
{
scan_dir($file);
}
}
closedir($handle);
echo "<br>\n" . number_format($total, 0, '.' , ' ') . ' - ' . $a;
}
?>
devi solo aggiungere i calcoli per le dimensioni ecc...
ciao ^__^