Created
May 21, 2015 10:36
-
-
Save 2803media/93982e83c3574fc914dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function folderSize($dir){ | |
| $count_size = 0; | |
| $count = 0; | |
| $dir_array = scandir($dir); | |
| foreach($dir_array as $key=>$filename){ | |
| if($filename!=".." && $filename!="."){ | |
| if(is_dir($dir."/".$filename)){ | |
| $new_foldersize = foldersize($dir."/".$filename); | |
| $count_size = $count_size+ $new_foldersize; | |
| }else if(is_file($dir."/".$filename)){ | |
| $count_size = $count_size + filesize($dir."/".$filename); | |
| $count++; | |
| } | |
| } | |
| } | |
| return $count_size; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment