Tutorials Infos - Anleitungen - Hilfe - Dreamcodes
 

Größe

Verzeichnissgrösse ermitteln
 
Script:
<?
   
function readsize_recursiv($path)
   {
      
$s = 0;

      
$result[$path] = 0;

      
$handle = opendir($path);

      if (
$handle)
      {
         while (
false !== ($file = readdir($handle)))
         {
             if (
$file != "." && $file != "..")
             {
                
$name = $path . "/" . $file;
                if (
is_dir($name))
                {
                   
$ar = readsize_recursiv($name);
                   while (list(
$key, $value) = each ($ar))
                   {
                      
$s++;
                      
$result[$key] = $value;
                   }
                }
                else
                {
                   
$result[$path] += filesize($name);
                }
             }
         }
      }
      
closedir($handle);
      return
$result;
   }

   
$data = readsize_recursiv(".");

   
$summe = 0;

   while (list(
$key, $value) = each ($data))
   {
     echo
"$key = $value byte<br>\n";
     
$summe += $value;
   }

   echo
"Gesamtgröße: $summe byte";
?>

 
ID: 1493
eingestellt am: 29.10.2007
Autor: Na
Status zum lesen: Gast
gelesen: 5907
Webseite: www.dreamcodes.com
[Drucken]