folder size

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

folder size

Post by m2babaey »

Hi
nice style!
I know how to get an uploaded file size. but how can i measure the size of a folder and all of its contents it has inside?
thanks
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: folder size

Post by Oren »

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: folder size

Post by Chris Corbyn »

Oren wrote:filesize()
This will work in combination with opendir() and some recursive scanning for files.

If you're on a UNIX/Linux system then you can also do:

Code: Select all

$dirSize = `du -s /path/to/dir`;
Post Reply