PHP/File Directory/Disk Drive

Материал из Web эксперт
Перейти к: навигация, поиск

Disk total space

   <source lang="html4strict">

<?php

  $systempartitions = array("/", "/home","/usr", "/www");
  foreach ($systempartitions as $partition) {
     $totalSpace = disk_total_space($partition) / 1048576;
     $usedSpace = $totalSpace - disk_free_space($partition) / 1048576;
     echo "Partition: $partition (Allocated: $totalSpace MB. Used: $usedSpace MB.) 
"; }

?>


      </source>
   
  


Get disk free space for Unix/Linux

   <source lang="html4strict">

<? $space = diskfreespace("/"); echo "$space"; ?>

      </source>
   
  


Get free disk space for C: drive

   <source lang="html4strict">

<? $space = diskfreespace("C:\\"); echo "$space"; ?>

      </source>