Found it, I had it returning mbyte not mbytes....arrrg
----- Original Message -----
From: ReDucTor <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 05, 2001 3:43 AM
Subject: [PHP] Division Problems


Hey, I made this little script, quiet useful on windows and unix machines,
but i have a problem, division isn't returning a float, it just returns 0,
would i need to do something like convert $totalsize into a float?
<html>
<body><?php
$SecondsToTimeout = 120;
ini_alter(max_execution_time, $SecondsToTimeout);
        function convert($bytes)
  {
   $kbytes = $bytes / 1024;
   $mbytes = $kbytes / 1024;
   $gbytes = $mbytes / 1024;
   $tbytes = $gbytes / 1024;

   return $mbyte;
  }
        function showdir($dir)
  {
     echo "<blockquote>";
     $handle = opendir($dir);
   while (false!==($file = readdir($handle)))


    if ($file != "." && $file != "..")


     if(is_file($dir."/".$file)){
     // Commented out for fixing this error
     // echo $file." (<i>".filesize($dir."/".$file)."
Bytes</i>)(<i>".filetype($dir."/".$file)."</i>)(<i>".fileperms($dir."/".$fil
e)."</i>)<br>\n";
     }
     if(is_dir($dir."/".$file)){
      $dirhandle = opendir($dir."/".$file);
      while(false!==($filetocheck=readdir($dirhandle))){
       if(!isset($totalsize))
        $totalsize = filesize($dir."/".$file."/".$filetocheck);
       else
        $totalsize = $totalsize + filesize($dir."/".$file."/".$filetocheck);
      }
      echo $file." (<i>".convert($totalsize)."</i>)<br>\n";
      showdir($dir.".".$file); // Put / on unix, and c:/ on windows
     }
      }
      }
   echo "</blockquote>";
  }
  showdir("/");
ini_restore(max_execution_time);
?></body></html>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to