예제 #1
0
						<td align="right" width="30%"><?php 
    echo $size[0];
    ?>
</td>
						<td width="25%" align="left"><?php 
    echo $size[1];
    ?>
</td>
					</tr>	
					</table>
			</td>
		</tr>
		<?php 
}
if (is_dir($path . $AlldataFile[$x])) {
    $total = getUserDirectorySize($path . $AlldataFile[$x]);
} else {
    $total = filesize($path . $AlldataFile[$x]);
}
$totalSize += $total;
?>
		<tr bgcolor="#EFEFEF">
			<td colspan="6" align="right"><b>
			<?php 
$totalSize = explode(" ", nicesize($totalSize));
?>
				<table  border="0" width="15%">
				<tr>
					<td align="right" width="48%"><b><?php 
echo $totalSize[0];
?>
예제 #2
0
function getUserDirectorySize($dir)
{
    $size = -1;
    if ($dh = @opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if ($file != "." and $file != "..") {
                $path = $dir . "/" . $file;
                if (is_dir($path)) {
                    $size += getUserDirectorySize("{$path}/");
                } elseif (is_file($path)) {
                    $size += filesize($path);
                }
            }
        }
        closedir($dh);
    }
    return $size;
}