You are here: Re: [PHP] filesize() Returns a file size. What will return a directorysize()??? « PHP « IT news, forums, messages
Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

Posted by Lupita on 03/29/05 19:51

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация