I tend to stay away from executing shell commands when it is not necessary.
I've written a script for you that will do what I think you want it to do. It will go n levels deep and get the file size in KB of each file, then it will return that. You can tell the script to ignore certain files (by default it ignores . and .., you may want to tell it to ignore itself as well) and what directory to give the size of. The source code is available at http://php.shadonet.com/diskspace.php.txt I've verified this works on my machine (4.3.0) and another machine (4.0.6) in safe mode. Jason On Sat, 2003-02-15 at 10:08, Don Read wrote: > > On 14-Feb-2003 joe wrote: > > > > "Jason Wong" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> On Saturday 15 February 2003 03:17, joe wrote: > >> > >> > now to the point... > >> > i need a script. it should work on safe mode php so it should be as > > simple > >> > as possible. > >> > it should calculate all the file sizes in the directory that it is in > > and > >> > in the subdirectories also (only 1 level subdirectories). it should echo > >> > the total size of the uploaded files. > >> > then it should take the filesize and substract it from 25 megabytes. > > that > >> > is the limit on this server. then it should echo the result (the maximum > >> > number of kilobytes that can still fit on this account). > >> > unfortunately i have insuffitient knowlege to do it miself. > >> > i just want to thank anyone who can help me. > >> > >> Most of the functions that you need to accomplish this can be found in > >> chapters 'Directory functions' & 'Filesystem functions'. > >> > >> -- > >> Jason Wong -> Gremlins Associates -> www.gremlins.biz > >> Open Source Software Systems Integrators > >> * Web Design & Hosting * Internet & Intranet Applications Development * > >> ------------------------------------------ > >> Search the list archives before you post > >> http://marc.theaimsgroup.com/?l=php-general > >> ------------------------------------------ > >> /* > >> We gave you an atomic bomb, what do you want, mermaids? > >> -- I. I. Rabi to the Atomic Energy Commission > >> */ > >> > > > > i searched and i tried and i failed. most of the functions dont work in safe > > mode, some didnt do what i wanted (returned the whole drive size instead of > > one directroy) etc. > > my head hurts already and i think i am on the verge on nervous breakdown > > because i have been trying to solve this problem for days.... so could > > somebody please drop me a function here? > > thank you... > > > > > > untested ... > > write a shell script (and put in your safe_mode_exec_dir): > --- > #!/bin/sh > > /usr/bin/du -k $1 | tail -1 > exit 0 > --- > > then use popen/fgets to call the script and parse output. > > Regards, > -- > Don Read [EMAIL PROTECTED] > -- "Beer is proof that God loves us and wants us to be happy." > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php