Simple script to get size of directory

<?php
$total_size = 0;

function get_filesize($dir,$total_size)
{
        foreach(glob("$dir/*") as $file)
        {
                if(is_dir($file))
                {
                        get_filesize($file,$total_size);
                }
                else
                {
                        $total_size = $total_size + filesize($file);
                }
        }

        return $total_size;
}

print(get_filesize("www",$total_size) . "\n");
?>

Page Comments (Click to edit)

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Powered by pmwiki-2.2.0-beta65