Advertisement
C_Volume2 OLE/ COM/ DCOM/ Active-X #84368

Dir_Size - Recursively get the size of a directory

Uses recursion to scan a directory and all subdirectories to get the total size of all files residing within.

AI

Podsumowanie AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kod źródłowy
original-source
$g_dirsize = 0;
function dir_size($dir)
{
	global $g_dirsize;
	$handle = opendir($dir);
	while($file = readdir($handle))
	{
		if($file != "." && $file != "..")
		{
			if(is_dir($dir . "/" . $file))
			{
				dir_size($dir . "/" . $file);
			}else{
				$g_dirsize += filesize($dir . "/" . $file);
			}
		}
	}
	return($g_dirsize);
}
Upload
Oryginalne komentarze (3)
Odzyskane z Wayback Machine