note 60259 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Sat, 02 May 2009 11:19:27 +0000 |
| Subject: | note 60259 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154127@lists.php.net to get a copy of this message | ||
Note Submitter: mateusz at bsdmail dot org
----
Recursive function, which returns size of folder or file.
<?php
function get_size($path)
{
if(!is_dir($path))return filesize($path);
$dir = opendir($path);
while($file = readdir($dir))
{
if(is_file($path."/".$file))$size+=filesize($path."/".$file);
if(is_dir($path."/".$file) && $file!="." && $file
!="..")$size +=get_size($path."/".$file);
}
return $size;
}
?>