Показать сообщение отдельно
Старый 28.05.2004, 12:31
Constantine вне форума Посмотреть профиль Отправить личное сообщение для Constantine Посетить домашнюю страницу Constantine Найти все сообщения от Constantine
  № 2  
Constantine
 
Аватар для Constantine

Регистрация: Jun 2000
Адрес: $_SERVER['REMOTE_ADDR']
Сообщений: 854
Код:
dmitri926 AT yahoo DOT com (07-Jan-2003 12:08):
i created function dir_size, it finds out the size of files in a 
directory and its subdirectories using recursion. it returns the
total size in bytes.
function dir_size($dir) {
$totalsize=0;
if ($dirstream = @opendir($dir)) {
while (false !== ($filename = readdir($dirstream))) {
if ($filename!="." && $filename!="..")
{
if (is_file($dir."/".$filename))
$totalsize+=filesize($dir."/".$filename);

if (is_dir($dir."/".$filename))
$totalsize+=dir_size($dir."/".$filename);
}
}
}
closedir($dirstream);
return $totalsize;
}