All pastes #982095 Raw Edit

gkloin

public php v1 · immutable
·published 2008-04-12 08:11 UTC
rendered paste body
<?function du($location) {   if (!$location or !is_dir($location)) {      return 0;   }   $total = 0;   $all = opendir($location);   while ($file = readdir($all)) {      if (is_dir($location.'/'.$file) and $file <> ".." and $file <> ".") {         $total += du($location.'/'.$file);         unset($file);      }      elseif (!is_dir($location.'/'.$file)) {         $stats = stat($location.'/'.$file);         $total += $stats['size'];         unset($file);      }   }   closedir($all);   unset($all);   return $total;}print du('l');?>