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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx> wrote in message 
news:C8F323573C030A448F3E5A2B6FE2070B08EB9051@xxxxxxxxxx
[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 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux