whelpton Posted April 3, 2008 Share Posted April 3, 2008 Well, for my hosting site I really need to be able to tell my users how much space theyve got left. Is there anyway of using php to check how large a certain folder is? Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted April 3, 2008 Share Posted April 3, 2008 I had this little snippet tucked away. It should help you. <?php $path = "gal"; echo "Folder $path = ".filesize_r($path)." bytes"; function filesize_r($path){ if(!file_exists($path)) return 0; if(is_file($path)) return filesize($path); $ret = 0; foreach(glob($path."/*") as $fn) $ret += filesize_r($fn); return $ret; } ?> Quote Link to comment Share on other sites More sharing options...
whelpton Posted April 3, 2008 Author Share Posted April 3, 2008 Thank you very much, just one more thing... is there anyway of making it not display "Folder ./test =" and just making it display the size of the folder Quote Link to comment Share on other sites More sharing options...
whelpton Posted April 3, 2008 Author Share Posted April 3, 2008 thanks I got it actually, I didnt see the Echo at the top =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.