ldain Posted June 24, 2008 Share Posted June 24, 2008 Is the a Way for php to tell the size of a folder and store the size in mb in a data bases thank you for any help Link to comment https://forums.phpfreaks.com/topic/111680-folder-size/ Share on other sites More sharing options...
waynew Posted June 24, 2008 Share Posted June 24, 2008 <?php $totalsize=0; function show_dir($dir, $pos=2){ global $totalsize; if($pos == 2) echo "<hr><pre>"; $handle = @opendir($dir); while ($file = @readdir ($handle)){ if (eregi("^\.{1,2}$",$file)) continue; if(is_dir($dir.$file)){ echo "|- ".$pos."s <b>$file</b>\n"; show_dir("$dir.$file/", $pos+3); }else{ $size=filesize($dir.$file); echo "|- ".$pos."s $file "; echo("$size <br>"); $totalsize=$totalsize+$size; } } @closedir($handle); if($pos == 2) echo "</pre><hr>"; return($totalsize); } $totalsize = show_dir("c:/winnt/system32/"); echo($totalsize); ?> http://www.alt-php-faq.org/local/25/ Link to comment https://forums.phpfreaks.com/topic/111680-folder-size/#findComment-573248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.