Re: Getting Dir Size?
| From: | Chris Anderson {Programmer Always} | Date: | Mon, 08 Jan 2001 18:37:39 +0000 |
| Subject: | Re: Getting Dir Size? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-33343@lists.php.net to get a copy of this message | ||
Brian, in lots of functions like fopen, ive seen people add @ signs. What
does that do? I have never used them
----- Original Message -----
From: "Brian Clark" <brianj@fusionwerks.com>
To: "PHP is not a drug ." <php-general@lists.php.net>
Sent: Monday, January 08, 2001 4:26 PM
Subject: Re: [PHP] Getting Dir Size?
>
> Hello Chris,
>
> (CAPA == "Chris Anderson {Programmer Always}") chrisderson@ameritech.net
writes:
>
> CAPA> Is their a way to get the size of all the files in a dir with
> CAPA> php?
>
> This doesn't traverse subdirectories, but it's a start.
>
> Hack away:
>
> <?php
>
> /* Untested code */
>
> $directory = '.'; /* current directory */
> $size = 0;
> $handle = @opendir($directory);
> while($file = @readdir($handle))
> {
> if(! ereg("\.{1,2}$", $file))
> {
> if(! is_dir($file))
> {
> $array = stat($file);
> $size += $array[7]; /* accumulative */
> }
> }
> }
> @closedir($handle);
>
> ?>
>
> -Brian
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>