note 46502 added to function.disk-free-space

From: Date: Wed, 13 Oct 2004 14:38:26 +0000
Subject: note 46502 added to function.disk-free-space
Groups: php.notes 
Request: Send a blank email to php-notes+get-78494@lists.php.net to get a copy of this message
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); } } } ---- Manual Page -- http://www.php.net/manual/en/function.disk-free-space.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46502 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46502&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46502&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78494) next »