Intenta
Código PHP:
$total=0;
$sizekb = 0.0 ;
$sizemb = 0.0 ;
$path='C:/'; /*Adicion*/
$dir=opendir($path);
while ($file = readdir($dir))
{
if($file != "index.php" AND $file != "" AND $file != "." AND $file != ".." && !is_dir($path.$file)) {
$total++;
$filesize=filesize($path.$file);
$sizekb=filesize($path.$file);
if($filesize < 1024){
$sizekb = filesize($path.$file).' bytes';
}else{
if($filesize > 1024 && $filesize < 1024000){
$sizekb = round(filesize($path.$file)/1024,2).' Kb';
}else{
if($filesize > 1024000){
$sizekb = round(filesize($path.$file)/1024000,2).' Mb';
}
}
}
echo('<a href="'.$file.'"> '.$file.'</a> @ '.$sizekb.'<br>');
}
}
closedir($dir) ;