note 22237 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Sun, 26 Sep 2004 00:21:44 +0000 |
| Subject: | note 22237 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77348@lists.php.net to get a copy of this message | ||
Note Submitter: andudi at gmx dot ch
----
To find the total size of a file/directory you have to differ two
situations:
(on Linux/Unix based systems only!?)
you are interested:
1) in the total size of the files in the dir/subdirs
2) what place on the disk your dir/subdirs/files uses
- 1) and 2) normaly differs, depending on the size of the inodes
- mostly 2) is greater than 1) (in the order of any kB)
- filesize($file) gives 1)
- "du -ab $file" gives 2)
so you have to choose your situation!
on my server I have no rights to use "exec du" in the case of
2), so I use:
$s = stat($file);
$size = $s[11]*$s[12]/8);
whitch is counting the inodes [12] times the size of them in Bits [11]
hopes this helps to count the used disk place in a right way... :-)
Andreas Dick