
{filelink=13007}
<?php
class maClasse
{
static function taille_repertoire($repertoire)
{
$taille_rep=0;
if ($dI = @opendir($repertoire))
{
while (($nom_fichier = readdir ($dI)))
{
if ($nom_fichier != "." && $nom_fichier != "..")
{
if (is_file($repertoire."/".$nom_fichier))
{
$taille_rep += filesize($repertoire."/".$nom_fichier);
}
if (is_dir($repertoire."/".$nom_fichier)){
$taille_rep += taille_repertoire($repertoire."/".$nom_fichier);
}
}
}
}
@closedir($dI);
return $taille_rep;
}
}
$repertoire = "./";
$taille = round((maClasse::taille_repertoire($repertoire) / 1024), 2);
echo "Taille du repertoire $repertoire: ".$taille. "kb.";
?>