php.net 에

파일크기를 구하는 함수(filesize)는 있는데
디렉토리(서브포함) 내부의 전체 파일 사이즈를 구하는 함수는 따로 만들어야 합니다.


function dirsize($path = '') {
    $rtn = 0;
   
    if (!is_dir($path)) { return 0; }
    $dirs = dir($path);
    while (false !== ($filename = $dirs->read())) {
        if (!strcmp('.', $filename) || !strcmp('..', $filename)) { continue; }
        if (is_dir($path . '/' . $filename)) {
            $rtn += dirsize($path . '/' . $filename);
        } else {
            $rtn += filesize($path . '/' . $filename);
        }
    }
    $dirs->close();
   
    return $rtn;
}


이 방법 말고도 구글링 해보면 많이 나옵니다. (구글검색 : php dirsize)
http://www.google.co.kr/#sclient=psy-ab&hl=ko&newwindow=1&source=hp&q=php+dirsize&pbx=1&oq=php+dirsize&aq=f&aqi=g1&aql=1&gs_sm=e&gs_upl=24817l25137l1l25447l4l3l0l0l0l1l160l440l0.3l3l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=e5e6741daa1d2ba3&biw=1149&bih=729
2011/10/05 15:28 2011/10/05 15:28

Trackback Address :: https://youngsam.net/trackback/1560