Reply to Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

Your name:

Reply:


Posted by Dotan Cohen on 03/29/05 23:11

On Tue, 29 Mar 2005 08:51:49 -0800, Lupita <lupita@lanset.com> wrote:
> 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
>
> --

You would be much better off looping through the files. I avoid
shellwrapping for many reasons, not the least of which is security.

Dotan Cohen

http://English-Lyrics.com/
http://Song-Lirics.com/

[Back to original 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

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