note 37797 deleted from function.filesize by tomsommer

From: Date: Wed, 01 Sep 2004 17:31:37 +0000
Subject: note 37797 deleted from function.filesize by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75874@lists.php.net to get a copy of this message
Note Submitter: el_goochi at hotmail dot com ---- I rewrote a script that was posted here before.. the scripts counts all files and folders on your whole server.. it results a list of all files + a survey of how many files,folders you have + the size of everything there is on your server.. have fun.. <?php function direcho($path) { global $filetotal, $fullsize, $totaldirs; if ($dir = opendir($path)) { while (false !== ($file = readdir($dir))) { if (is_dir($path."/".$file)) { // if it's a dir, check it's contents too if ($file != '.' && $file != '..') { // but dont go recursive on '.' and '..' echo '<li><b>' . $file . '</b></li><ul>'; direcho($path."/".$file); echo '</ul>'; $totaldirs++; } } else { //if it's not a dir, just output. $tab = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; $filesize = $tab . '(' . filesize ($path.'/'.$file) . ' kb)'; echo '<li>' . $file . $filesize . '</li>'; $fullsize = $fullsize + filesize ($path.'/'.$file); $filetotal++; } } closedir($dir); } } direcho('.'); $fullsize = round($fullsize / 1024 / 1024, 2); echo"<br><br> <b>Total files</b> - $filetotal files<br> <b>Total dirs</b> - $totaldirs directories<br> <b>Total size</b> - $fullsize MB<br> "; ?>

« previous php.notes (#75874) next »