note 72176 added to function.readdir

From: Date: Fri, 05 Jan 2007 18:31:06 +0000
Subject: note 72176 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-121327@lists.php.net to get a copy of this message
Function that get dir (and all it childs) size: function dirsize($path,$top=true) { static $total_size=0; if ($top==true) $total_size=0; if (is_dir($path)) { $dir=opendir ($path); while (($item = readdir($dir)) !== false) { if ($item=="." || $item=="..") continue; $full_path="$path/$item"; if (is_file($full_path)) $total_size+=filesize($full_path); else if (is_dir($full_path)) dirsize($full_path,false); } closedir($dir); return $total_size; }else return -1; } ---- Server IP: 66.163.161.117 Probable Submitter: 87.116.131.161 (proxied: 192.168.0.3) ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- https://master.php.net/note/edit/72176 Del: integrated -- https://master.php.net/note/delete/72176/integrated Del: useless -- https://master.php.net/note/delete/72176/useless Del: bad code -- https://master.php.net/note/delete/72176/bad+code Del: spam -- https://master.php.net/note/delete/72176/spam Del: non-english -- https://master.php.net/note/delete/72176/non-english Del: in docs -- https://master.php.net/note/delete/72176/in+docs Del: other reasons-- https://master.php.net/note/delete/72176 Reject -- https://master.php.net/note/reject/72176 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121327) next »