note 37879 added to function.stat
| From: | greenie at oddpost dot com | Date: | Mon, 01 Dec 2003 03:57:41 +0000 |
| Subject: | note 37879 added to function.stat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61188@lists.php.net to get a copy of this message | ||
I was hoping someone could help with a problem I'm having...
I'm trying to determine the total size of a particular directory, but the stat function always
returns 0 when it is pointed to a directory instead of a file.
Here's the code I'm using:
$aryDirectoryStats = stat( "c:/mydirectory/" );
$intDirectorySize = $aryDirectoryStats["size"];
echo( "Directory size: " . $intDirectorySize . " bytes" );
clearstatcache();
However, if I modify the first line slightly so it points to a file instead of a directory, it works
fine:
$aryDirectoryStats = stat( "c:/mydirectory/myfile.foo" );
Any insights? I'm running PHP 4.3.4 (Apache 1.3 / WinXP).
----
Manual Page -- http://www.php.net/manual/en/function.stat.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37879
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37879&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37879&report=yes
Search -- http://master.php.net/manage/user-notes.php