static function filesizeDirectory($path)
{
if (!is_dir($path)) {
return filesize($path);
}
if ($handle = opendir($path)) {
$size = 0;
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$size += filesize($path . '/' . $file);
$size += self::filesizeDirectory($path . '/' . $file);
}
}
closedir($handle);
return $size;
}
}