Re: filesize() Returns a file size. What will return a directorysize()???

From: Date: Tue, 29 Mar 2005 16:51:49 +0000
Subject: Re: filesize() Returns a file size. What will return a directorysize()???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-211790@lists.php.net to get a copy of this message
Yes it is on a Linux system. I have done a little research and I am having a hard time finding info about executing shell commands with php. This seems like a very interesting possibility being able to use shell commands. Any info you could point me to would be very appreciated. I did find this piece of code that doesn't work for me. Maybe it is missing something? <?php $mstrng = shell_exec('du -sc home/joeuser/www/testdir/'); print "$mstrng"; ?> It produces "0 total" and I know there is more then 11 kb of file in the directory. I tried it pointed directly at the file in the directory and I also tried the "du -h". Thank you so much for your response. "Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message news:C8F323573C030A448F3E5A2B6FE2070B08EB9051@nemesis... [snip] I have been looking for a solution to get the disk size of a directory. I would like to be able to get the size of a directory with sub directories under it. Will I need to loop through file sizes to get the total directory size? [/snip] If you are on a *nix system of some sort you could exec du -h

« previous php.general (#211790) next »