Re: Calculate Directory Size
| From: | Alan McFarlane | Date: | Sat, 26 Jan 2002 15:33:07 +0000 |
| Subject: | Re: Calculate Directory Size | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82216@lists.php.net to get a copy of this message | ||
I suggest using an external tool - using PHP would probably be too slow esp.
if you're hitting 1000+ users. (Plus, I think you would have to run a lot of
clearstatcache()'s which may cause all sorts of problems)...
If you do an ls or dir or similar then you could parse the output, however
there must be a decent tool out there somewhere that runs nice and fast.
Simon H <simon.hamilton@ntlworld.com> wrote in message
news:ABEOLCLBKCFMEMHDPKLMIEIKCJAA.simon.hamilton@ntlworld.com...
> On advice, I've moved this from the Pear list. I have a
> problem...hopefully someone can help, because I've no idea where
> to even start!
>
> I have a user database, with a table called Users, and fields as so:
>
> (it would be cool if this would work on both Linux and Windows)
>
> -------------------------------------------------------------
> User DiskUsage (Mb) Quota (Mb) HomeDirectory
> -------------------------------------------------------------
> jim 50 100 F:\users\jim \\ In Windows
>
> jim 50 100 /users/jim \\ In Linux
> -------------------------------------------------------------
>
>
> The database wouldn't be shared between Windows and Linux, just 1 or the
> other.
>
> What I would like to be able to do is, press a button on a php page, and
> scan the (MySQL or ODBC through Pear DB) database, and for each user,
> calculate the size of their HomeDirectory, and Update the DiskUsage in the
> DB accordingly.
>
> I'm wondering tho how this would work with say 1000's of users each with
> several hundred Mb's or even several Gb's each. The users will have
> subfolders too, so the function would have to recurse the dirs, if
> possible.
>
> Is this even possible with PHP?
>
> I appreciate any help I can get on this, because its waaaaaay beyond me
> presently.
>
> Thanks
>
> Simon H
>