This one will work for one directory with several sub directories under it, if there are subdirs within the subdirs some tweaking may be necassary:
<?php
$basedir = "/home/something/www/";
chdir($basedir);
$dir = dir(".");
while ($file = $dir->read()) {
if (is_file($file)) {
$totalfilesize = $totalfilesize + filesize($file);
}
if (is_dir($file) && (($file != ".") && ($file != ".."))) {
$dirs[] = $file;
}
}
while (list ($key, $val) = each ($dirs)) {
chdir($basedir.$val);
$dir = dir(".");
while ($file = $dir->read()) {
if (is_file($file)) {
$totalfilesize = $totalfilesize + filesize($file);
}
}
chdir($basedir);
}
print "total file size= " . number_format(($totalfilesize / 1000), 2) ." kb";
?>