<?php /** * 获取文件夹及子文件夹大小 * by www.jbxue.com */ function holdersize($hold,$holdersize=0){ if (@$handle = opendir($hold)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(is_dir($hold.'/'.$file)) holdersize($hold.'/'.$file,$holdersize); $holdersize=$holdersize+filesize($hold.'/'.$file); } } return $holdersize; }else return '无法获取'.$hold.'目录'; } ?> |
|