note 19526 added to function.disk-total-space

From: Date: Fri, 01 Mar 2002 20:38:37 +0000
Subject: note 19526 added to function.disk-total-space
Groups: php.notes 
Request: Send a blank email to php-notes+get-27240@lists.php.net to get a copy of this message
If you want to use this to give the user the size of his account (or the admin the size of the user's folder) in a more human readable format, you can use this function dirsize($dir) { $dh = opendir($dir); $size = 0; while (($file = readdir($dh)) !== false) if ($file != "." and $file != "..") { $path = $dir."/".$file; if (is_dir($path)) $size += dirsize($path); elseif (is_file($path)) $size += filesize($path); } closedir($dh); $mgs_size = $size/1048576; return $mgs_size; } it will return the value in megabytes so it's more easy to read. This is a negligable addition to the very usefull function posted by flagzen -- http://www.php.net/manual/en/function.disk-total-space.php http://master.php.net/manage/user-notes.php?action=edit+19526 http://master.php.net/manage/user-notes.php?action=delete+19526 http://master.php.net/manage/user-notes.php?action=reject+19526

« previous php.notes (#27240) next »