Re: DirectoryIterator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 26, 2010 at 2:01 PM, Kim Madsen <php.net@xxxxxxx> wrote:

> Christoph Boget wrote on 26/01/2010 21:17:
>
>  I've looked through the docs but was unable to find out if this is
>> possible;
>> I hope it is.  Is there a way that you get the size/length of the
>> collection
>> to be iterated (e.g. the total number of files) without having to iterate
>> through at least once?
>>
>
> On Linux with safe mode off you can call system("du -hcs THE_DIR") to get
> the size of all files, no iterations needed.
>

right, thats the size, not a count of them.


> Number of files could be a find command piped into wc -l, called from
> system(), like find . -name "*" | wc -l (but that would count dirs aswell)
>

right, so on linux, you need to iterate over the filesystem to get a count
(unless someone knows a magic command the os / shell provides which returns
this info in a single call).

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux