Toolbox::filesizeDirectory PHP Méthode

filesizeDirectory() static public méthode

Get the filesize of a complete directory (from php.net)
static public filesizeDirectory ( $path ) : size
$path string: directory or file to get size
Résultat size of the $path
    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;
        }
    }