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? Link to comment https://forums.phpfreaks.com/topic/99313-help-with-space/ 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; } ?> Link to comment https://forums.phpfreaks.com/topic/99313-help-with-space/#findComment-508135 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 Link to comment https://forums.phpfreaks.com/topic/99313-help-with-space/#findComment-508150 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 =) Link to comment https://forums.phpfreaks.com/topic/99313-help-with-space/#findComment-508153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.