PHP
  Home arrow PHP arrow Page 11 - File And Directory Manipulation In PHP...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

File And Directory Manipulation In PHP (part 2)
By: icarus, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 59
    2003-08-21

    Table of Contents:
  • File And Directory Manipulation In PHP (part 2)
  • Stripping It To The Bone
  • Fertile Fields
  • Configuring The System
  • The Right Path
  • Move It
  • Beam Me Up
  • Diving Into Directories
  • A Pattern Emerges
  • Purging The Dead
  • Size Does Matter
  • In Process
  • Disk Full

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    File And Directory Manipulation In PHP (part 2) - Size Does Matter
    (Page 11 of 13 )

    If you're looking for information on the total size of a partition or mount point, PHP offers the relatively-new disk_total_space() and
    disk_free_space() functions, which return the total available space and total free space, in bytes, on a particular partition. Consider the following example, which demonstrates:


    <?php

    // set partition
    $fs = "/";

    // display available and used space
    echo "Total available space: " . round(disk_total_space($fs) / (1024*1024)) . " MB\r\n"; echo "Total free space: " . round(disk_free_space($fs) / (1024*1024)) . " MB\r\n";

    // calculate used space
    $disk_used_space =
    round((disk_total_space($fs) - disk_free_space($fs)) / (1024*1024)); echo "Total used space: " . $disk_used_space . " MB\r\n";

    // calculate % used space
    echo "% used space: " . round((disk_total_space($fs) -
    disk_free_space($fs)) / disk_total_space($fs) * 100) . " %";

    ?>

    Here's an example of what the output might look like:


    Total available space: 7906 MB
    Total free space: 4344 MB
    Total used space: 3562 MB
    % used space: 45 %

    More PHP Articles
    More By icarus, (c) Melonfire


     

       

    PHP ARTICLES

    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5
    - Working with Multiple Document Nodes with th...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway