public function size()
{
$size = 0;
$items = $this->content(array('.', '..'));
foreach ($items as $item) {
$size += $item->size();
}
return $size;
}
/** * Gets the size of the directory and all subfolders and files * * @param string $dir The path of the directory * @return mixed */ public static function size($dir) { if (!file_exists($dir)) { return false; } // It's easier to handle this with the Folder class $object = new Folder($dir); return $object->size(); }