Page 1 of 1

disk_total_space

Posted: Fri Jun 11, 2004 5:13 pm
by hward
I am tryign to figure out how to show the total space of a directory

the directory is on a linux system /dir/dir/

I found this code on php.net

Code: Select all

<?php
// $df contains the total number of bytes available on "/"
$df = disk_total_space("/");

// On Windows:
disk_total_space("C:");
disk_total_space("D:");
?>
Does this only work on windows file systems?

Posted: Fri Jun 11, 2004 8:21 pm
by dull1554
give this a try
>>>>it's out of the PHP manual....

Code: Select all

function Du($dir)
{
       $du = popen("/usr/bin/du -sk $dir", "r");
       $res = fgets($du, 256);
       pclose($du);
       $res = explode(" ", $res);
       return $res[0];
}

Posted: Fri Jun 11, 2004 9:05 pm
by hward
thanks i put a couple together i found in the manual and got it working

Posted: Fri Jun 11, 2004 10:12 pm
by dull1554
great