<?php$dir = new RecursiveDirectoryIterator('C:\wamp');$totalSize = 0;foreach (new RecursiveIteratorIterator($dir) as $file) { $totalSize += $file->getSize();}print "The total size is $totalSize.\n";?>
来源: http://www.phpxs.com/code/1003189/