note 53750 added to function.filesize

From: Date: Sat, 11 Jun 2005 17:29:40 +0000
Subject: note 53750 added to function.filesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-90272@lists.php.net to get a copy of this message
a simple and imo good function for calculating size of a dir and all files in it. will return the value in bytes. and if it's not a dir it will return 0 <? function size_of_dir($str_dir) { $int_size = 0; if (is_dir($str_dir)) { if ($dh = opendir($str_dir)) { while (($file = readdir($dh)) != false) { if($file != "." && $file != "..") { if(is_dir($str_dir . $file)) { $int_size += size_of_dir($str_dir."/".$file); } else { $int_size += filesize($str_dir."/".$file); } } } } } closedir($dh); return $int_size; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.filesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53750 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53750&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53750&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53750&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53750&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53750&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53750&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90272) next »