Re: Calculate Directory Size
| From: | Tomas V.V.Cox | Date: | Sun, 27 Jan 2002 17:33:13 +0000 |
| Subject: | Re: Calculate Directory Size | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-742@lists.php.net to get a copy of this message | ||
Simon H wrote:
>
> 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.
>
> Is this even possible with PHP?
I wouldn't do it directly with PHP. My recomendation would be a cron job
that executes a "du -s /home/*" and processing the output with a PHP
script. Perhaps you might want to try the "durep" utility
(freshmeat.net).
Tomas V.V.Cox