note 46502 deleted from function.disk-free-space by tomsommer

From: Date: Wed, 13 Oct 2004 14:57:45 +0000
Subject: note 46502 deleted from function.disk-free-space by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-78495@lists.php.net to get a copy of this message
Note Submitter: chrysb.com ---- I am revising a function posted earlier by "ju sun lee dot com". There was a problem: It was including "." and ".." in the total size count, here is a more readable, fixed version of the code: function spaceUsed($dir) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (is_dir($dir.$file) && $file != '.' && $file != '..') { spaceUsed($dir.$file.'/'); } elseif( $file != '.' && $file != '..' ) { $GLOBALS['total'] += filesize($dir.$file); $GLOBALS['filecount']++; } } closedir($dh); } } }

« previous php.notes (#78495) next »