![]() |
Calculate directory size using PHP
I was wondering whether i could read the size of a directory using PHP. So i thought of making something which could help me read the size of the directory ,no. of directories and the no. of files in the given diretory.
The function "getDirectorySize" will ignore link/shorcuts to files/directory. The function "sizeFormat" will suffix the size with bytes,KB,MB or GB accordingly. Here is the code: PHP Code:
PHP Code:
Details for the path : /httpd/html/pradeep/ ------------------------------------------------------------ This Article is written by S Pradeep for Programming Forum ------------------------------------------------------------ This article is freely available for reprint provided that the resource box at the end of the article is left intact and the article is published complete and unaltered. If you are using this article on a website or e-book, please make sure that the link in the resource box is live and clickable. |
Re: Calculate directory size using PHP
May I use this code on a web site? Is there some kind of copyright or credit notice I should include? Thanks.
|
Re: Calculate directory size using PHP
Quote:
|
Re: Calculate directory size using PHP
Thanks. I wasn't sure because that line is referring to use the article, complete and unaltered. I'm not really using the article, just the code. I wasn't sure what the "resource box" was either. So if I just include a live link back to this thread, would that be acceptable?
|
Re: Calculate directory size using PHP
Quote:
|
Re: Calculate directory size using PHP
This Examlpe to calculate directory size using PHP.
PHP Code:
|
Re: Calculate directory size using PHP
You actually can. Go search for the codes, you will need that to do have it calculated. The URL is not working. Can you PM another link for this? Thank you!
|
Re: Calculate directory size using PHP
Refinance a home mortgage
|
Re: Calculate directory size using PHP
It is good, but I would use the later source code.
|
Re: Calculate directory size using PHP
PHP Code:
|
| All times are GMT +5.5. The time now is 00:12. |