I have this script that I have been using to calculate how much disk space is in a given directory:
function du($dirPath)
{
$count = 0;
$dir = dir($dirPath);
while ($file = $dir->read())
{
if ( $file == ".." || $file == "." || substr($file,0,1) == "." )
continue;
$file = $dirPath . "/" . $file; // get the full path
if (is_file($file)) // a file?
{
$count += filesize($file);
}
else if (is_dir($file)) // a sub-directory? then recursively scan it
{
$count += du($file);
}
}
$dir->close();
return($count);
}
It appears that this scrpt is not working properly. I get different numbers when I run this, and then if I telnet to the box and run a du from the command line.
Any ideas to make the work?
all help is appreciated...