DISK_FREE_SPACE(3) 1 DISK_FREE_SPACE(3)disk_free_space - Returns available space on filesystem or disk partitionSYNOPSIS
float disk_free_space (string $directory)
DESCRIPTION
Given a string containing a directory, this function will return the number of bytes available on the corresponding filesystem or disk
partition.
PARAMETERS
o $directory
- A directory of the filesystem or disk partition.
Note
Given a file name instead of a directory, the behaviour of the function is unspecified and may differ between operating sys-
tems and PHP versions.
RETURN VALUES
Returns the number of available bytes as a float or FALSE on failure.
EXAMPLES
Example #1
disk_free_space(3) example
<?php
// $df contains the number of bytes available on "/"
$df = disk_free_space("/");
// On Windows:
$df_c = disk_free_space("C:");
$df_d = disk_free_space("D:");
?>
NOTES
Note
This function will not work on remote files as the file to be examined must be accessible via the server's filesystem.
SEE ALSO disk_total_space(3).
PHP Documentation Group DISK_FREE_SPACE(3)
Check Out this Related Man Page
DIRNAME(3) 1 DIRNAME(3)dirname - Returns parent directory's pathSYNOPSIS
string dirname (string $path)
DESCRIPTION
Given a string containing the path of a file or directory, this function will return the parent directory's path.
PARAMETERS
o $path
- A path. On Windows, both slash ( /) and backslash ( ) are used as directory separator character. In other environments, it is
the forward slash ( /).
RETURN VALUES
Returns the path of the parent directory. If there are no slashes in $path, a dot (' .') is returned, indicating the current directory.
Otherwise, the returned string is $path with any trailing /component removed.
CHANGELOG
+--------+-------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-------------------------------+
| 5.0.0 | |
| | |
| | dirname(3) is now binary safe |
| | |
+--------+-------------------------------+
EXAMPLES
Example #1
dirname(3) example
<?php
echo "1) " . dirname("/etc/passwd") . PHP_EOL; // 1) /etc
echo "2) " . dirname("/etc/") . PHP_EOL; // 2) / (or on Windows)
echo "3) " . dirname("."); // 3) .
?>
NOTES
Note
dirname(3) operates naively on the input string, and is not aware of the actual filesystem, or path components such as " ..".
Note
dirname(3) is locale aware, so for it to see the correct directory name with multibyte character paths, the matching locale must be
set using the setlocale(3) function.
Note
Since PHP 4.3.0, you will often get a slash or a dot back from dirname(3) in situations where the older functionality would have
given you the empty string.
Check the following change example:
<?php
//before PHP 4.3.0
dirname('c:/'); // returned '.'
//after PHP 4.3.0
dirname('c:/x'); // returns 'c:'
dirname('c:/Temp/x'); // returns 'c:/Temp'
dirname('/x'); // returns ''
?>
SEE ALSO basename(3), pathinfo(3), realpath(3).
PHP Documentation Group DIRNAME(3)
What utility (or combination of utilities) can I use to find out how much disk space a directory and its subdirectories take up.
I currently am using 'df' to see partition space/size,
'ls' doesn't seem like displaying directory info
TIA
SmartJuniorUnix (2 Replies)
i am a fresh person learning sco open server 5.5:confused:
how should i know that how much space is occupied & how much is free on a particular partition?please help (1 Reply)
I think I need a little help here... I have a RedHat 7.2 server here, and I think I'm pretty proficient with it, however, this one thing keeps bugging me....
For some reason, I ran out of space on the root partition of this machine. I had set it to 1.2Gb which should be plenty for the OS... (1 Reply)
Hi,
I define 2 new LV on the vio server and run a cfgmgr on the partition and see my 2 new hdisk (hdisk6 and hdisk7).
I extend my vg vg000 (on the partition) and add the 2 hdisks.
I had a filesystem on the vg000 and when I added the disk I would like to increase the filesystem. But I cannot do a... (0 Replies)
When i was trying to store a file of size 743 MB into a directory i got a msg. that the disk is full. But when i used the df -k . command on that directory it showed only 40% in usage and the disk had more than enough memory for the file. When i checked the syslog i found that at that instant of... (2 Replies)
I have a directory, and I write some files in to that. How to throw the error exception when my directory is full. i.e. there is no disk space (2 Replies)
Hi,
I have found a directory on my web server that have 2 same directory names in the same location on the same partition. Is there a way to mkdir a name twice and be able to see them both in the same location?
Heres an example of the ouput:
# ls
access_log.1.bkup ... (10 Replies)
Hello when I examined the partition information of one of our servers I saw the following:
10.20.5.2:/ha0/critical
Fstab has a similar entry. Seems that the server is accessing a partition on a remote machine.
What else is required to setup a partition that accesses a remote machine... (2 Replies)
I need to add space to certain directory. I believe I need to add space to the filesystem this directory belongs to. How can I find out what filesystem this directory belongs to? (3 Replies)
Hello,
I am using Red Hat linux system. I see my /work directory has used space 300GB. But there are so many sub directory under /work. I want to list each direcotry and under all subdirectory. But i want to know how much space occupied by each directory. What kind of command i can use to... (3 Replies)
Hi,
I want to know how to get size of each directory and each sub-directory on each disk, assume i have 20 disk.
Could you help me to find out the solution, please?
Thanks (1 Reply)
Hi all,
I've been working on a script to run a disk wipe (using Jim Garlick's scrub tool) on the filesystem in Xerox production printer RIPs.
Easy enough if there's just one partition, but I need to cater for the possibility of multiple drives/partitions, and either ZFS or UFS (don't know if... (2 Replies)
Hello guys. I really hope someone will help me with this one..
So, I have to write this script who:
- creates a file home/student/vmdisk of 10 mb
- formats that file to ext3
- mounts that partition to /mnt/partition
- creates a file /mnt/partition/data. In this file, there will... (1 Reply)