You can try something like this. 

$dir = "dir";

function dirsize($checkdir) {
    $dh = opendir($checkdir);
    $size = 0;
    while (($file = readdir($dh)) !== false)
        if ($file != "." and $file != "..") {
            $path = $checkdir."/".$file;
            if (is_dir($path))
                $size += dirsize($path);
            elseif (is_file($path))
                $size += filesize($path);
        }
    closedir($dh);
 $formated_size = $size /1000;
    return $formated_size;
}

$getFolderSize = dirsize("/files/personal");


Jeff



----- Original Message ----- 
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Antti" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 03, 2003 4:37 AM
Subject: Re: [PHP] Directory size


> there is no php function for this, you can use unix command du or do it 
> in a loop
> 
> Antti wrote:
> 
> > How do I get the directory size? Suppose there is a function for this.
> >
> > antti
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to