| ||||||
|
How to calculate how much free disk space is left within a specified location using PHP
Disk space is one of those things most programmers rarely think about. Until the moment it is all used up that is! Lucky PHP has a function with the sole purpose of returning the amount of free disk space left within a specified location. In the following example code we will determine the amount of free disk space left within the route folder. Note that the free amount will be returned in bytes, so you better have your mathematicians hat on to convert the returned value into Giga and Megabytes! <?php $dir = "/"; echo "The directory \"$dir\" has ".disk_free_space($dir)." bytes of free space!"; ?>
|