note 94280 deleted from function.filesize by danbrown

From: Date: Tue, 27 Oct 2009 00:46:40 +0000
Subject: note 94280 deleted from function.filesize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162136@lists.php.net to get a copy of this message
Note Submitter: Kevin ---- // Get the size of all files within a directory function dirSize($dir) { $totalSize = 0; $fileCount = 0; $dirCount = 0; $files = glob($dir.'*', GLOB_MARK); foreach( $files as $file ){ if( substr($file, -1) == '/' || substr($file, -1) == '\\' ) { $result = dirSize($file); $dirCount++; $totalSize += $result['size']; $fileCount += $result['fileCount']; $dirCount += $result['dirCount']; } else { $totalSize += filesize($file); $fileCount++; } } $total['size'] = $totalSize; $total['fileCount'] = $fileCount; $total['dirCount'] = $dirCount; return $total; }

« previous php.notes (#162136) next »