<?php
function Yget_dir_size($dir, $debug=false){
if (!is_dir($dir)) return false;
if (!preg_match("`/$`", $dir)) $dir .= '/';
$get_size = 0;
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if (substr($entry, 0, 1) == '.') continue;
if (is_file($dir . $entry)) {
$get_size += filesize($dir . $entry);
if ($debug == true) echo $dir . $entry . ' ' . filesize($dir . $entry) . "<br>\n";
}
else if (is_dir($dir . $entry)){
$get_size += Yget_dir_size($dir . $entry, $debug);
}
else{
continue;
}
}
$d->close();
return $get_size;
}
$dir = '용량체크하고픈 디렉토리경로(상대경로 or 절대경로)';
echo Yget_dir_size($dir, true);//개별파일출력을 원할 경우
echo Yget_dir_size($dir);//개별파일출력을 원하지 않을경우
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
function Yget_dir_size($dir, $debug=false){
if (!is_dir($dir)) return false;
if (!preg_match("`/$`", $dir)) $dir .= '/';
$get_size = 0;
$d = dir($dir);
while (false !== ($entry = $d->read())) {
if (substr($entry, 0, 1) == '.') continue;
if (is_file($dir . $entry)) {
$get_size += filesize($dir . $entry);
if ($debug == true) echo $dir . $entry . ' ' . filesize($dir . $entry) . "<br>\n";
}
else if (is_dir($dir . $entry)){
$get_size += Yget_dir_size($dir . $entry, $debug);
}
else{
continue;
}
}
$d->close();
return $get_size;
}
$dir = '용량체크하고픈 디렉토리경로(상대경로 or 절대경로)';
echo Yget_dir_size($dir, true);//개별파일출력을 원할 경우
echo Yget_dir_size($dir);//개별파일출력을 원하지 않을경우
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
댓글 6개
게시글 목록
| 번호 | 제목 |
|---|---|
| 11348 |
정규표현식
정규식 표현법
|
| 11346 |
웹서버
리눅스 기본 명령어
1
|
| 11345 |
jQuery
ajax 예제 입니다.
|
| 11336 |
jQuery
jQuery Performance
8
|
| 11332 |
jQuery
jQuery Event - 이벤트에 생명을~
3
|
| 11329 |
jQuery
jQuery Event - bind() 메서드
2
|
| 11326 |
jQuery
jQuery Event - 이벤트 지원 메서드
2
|
| 11324 | |
| 11323 | |
| 11321 | |
| 11320 |
jQuery
jQuery Core
|
| 11319 | |
| 11318 |
jQuery
jQuery Traverse - Filtering
|
| 11317 | |
| 11316 | |
| 11315 | |
| 11314 | |
| 11313 | |
| 11312 | |
| 11311 | |
| 11310 | |
| 11308 | |
| 11304 |
JavaScript
주소표시
3
|
| 20200 |
CSS
CSS 자료 링크
4
|
| 11300 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기