I'm sorry, but I won't be much help on the windows side of things, but for
UNIX, the job is already done for you!  There is a utility called 'du',
which will tell you the disk usage of a file (or a folder and its contents).
Specifically, you would want to use the -s flag to specify only to show the
grand total, and not the size of each file...  type 'du --help' or 'man du'
at the command line to find out more.  But an example:

du -s -m /path/to/users/home/dir/

that will tell you in MB how much disk space they are using.  Careful
though, this is checking all their files recursively, so this can get
cpu/hdd intense if you are using it for lots of users.  My advice would be
to run your script when there is a low load on the server.

I hope that helps get you started.

Jeff

> Simon H <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > 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
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to