<?php

function getFileSize($file) {
	$size = filesize($file);
	$mb = round($size/(1024*1024), 2);
	return $mb.' MB';
	$kb = $size%1024;
	$size = '';
	if ($mb > 0) {
		$size = $mb.' MB ';
	}
	$size .= $kb.' KB';
	return $size;
}

function drawDir($d = './') {
	$dir = opendir($d);
	echo '<ul>';
	while ($file = readdir($dir)) {
		if ($file != '.' and $file != '..' and !strpos($file, '.php') and $file != 'robots.txt' and $file != 'Thumbs.db') {
			if (is_dir($d.$file)) {
				echo '<li><strong>'.str_replace('./', '', $d).$file.'/</strong>';
				drawDir($d.$file.'/');
				echo '</li>';
			}
			else {
				echo '<li><a href="'.$d.$file.'">'.$file.'</a> ('.getFileSize($d.$file).')</li>';
			}
		}
	}
	echo '</ul>';
	closedir($dir);
}
?>
<html>
<head>
	<title>Raudsilla</title>
</head>
<body>
<ol>
<?php
drawDir();
?>
</ol>
</body>
</html>