What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Another PHP Help Thread (Getting size of folders)

Another PHP Help Thread (Getting size of folders)
Author: Message:
L. Coyote
Senior Member
****

Avatar
Captain Obvious

Posts: 981
Reputation: 49
39 / Male / Flag
Joined: Aug 2004
Status: Away
RE: Another PHP Help Thread (Getting size of folders)
Basically I just took off truesize() (it doesn't exist :s or you forgot to add it here), changed the quotes to my style (I mostly use single quotes). Not really a big change, imo. I did take off a / slash (it's commented).

I ran it in a big directory and gave me the correct bytes (Y)

code:
<?
function foldersize($folder){
if($handle = opendir($folder)) {
  while (false !== ($file = readdir($handle))) {
   if($file !='.' && $file !='' && $file != '..'){ // no / slash in $file != '../'
    if(is_dir($folder.'/'.$file)){
    $foldersize = $foldersize + foldersize($folder.'/'.$file);
    }else{
    $foldersize = $foldersize + filesize($folder.'/'.$file);
    }
   }
  }
}
closedir($handle);
clearstatcache();
return $foldersize;
}

$total = foldersize('projects');

echo $total;
?>

Edit: took off the $temps.

Btw, when I started to reply to this thread it didn't have replies, but the preview page slowed me down. :s

This post was edited on 01-31-2005 at 06:59 AM by L. Coyote.

Hack, hack, hack!
Finally became a Systems Analyst! :spam:

01-31-2005 06:49 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Another PHP Help Thread (Getting size of folders) - by Ash_ on 01-31-2005 at 06:32 AM
RE: Another PHP Help Thread (Getting size of folders) - by WDZ on 01-31-2005 at 06:41 AM
RE: Another PHP Help Thread (Getting size of folders) - by Ash_ on 01-31-2005 at 06:45 AM
RE: Another PHP Help Thread (Getting size of folders) - by -dt- on 01-31-2005 at 06:48 AM
RE: Another PHP Help Thread (Getting size of folders) - by WDZ on 01-31-2005 at 06:48 AM
RE: Another PHP Help Thread (Getting size of folders) - by L. Coyote on 01-31-2005 at 06:49 AM
RE: Another PHP Help Thread (Getting size of folders) - by WDZ on 01-31-2005 at 06:56 AM
RE: Another PHP Help Thread (Getting size of folders) - by Ash_ on 01-31-2005 at 07:12 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On