note 36887 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Sun, 26 Sep 2004 00:20:30 +0000 |
| Subject: | note 36887 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77342@lists.php.net to get a copy of this message | ||
Note Submitter: mehdi at ict dot iut dot ac dot ir
----
this function returns the size of $file whether or not it is a directory.
function fsize($file){
$size;
if(is_dir($file))
if ($dh = opendir($file))
while (($filecnt = readdir($dh)) !== false) {
if($filecnt == "." || $filecnt == "..")continue;
if(is_dir($file."/".$filecnt))
$size += fsize($file."/".$filecnt);
else
$size += filesize($file."/".$filecnt);
}
else
return false;
else
$size = filesize($file);
return $size;
}