<?  

// definimos o diretorio abrindo-o
$handle = opendir('.'); 
$strDiretorio = "./";  
?> 

<table width="351"  border="0" cellspacing="0" cellpadding="10">
<tr> 

<?php 

$totalpasta = count($pastas); 
//junta os 3 arrays pra dividir em colunas 

$temp = glob("{*.jpg}", GLOB_BRACE); //vc pode escolher a estensao q quiser. Neste caso, so l� arquivos jpg.

rsort($temp); //coloca em ordem decrescente
foreach($temp as $str)
{


   if (($cont % 3) == 0) { 
              echo "</tr> 
              <tr>"; 
   } 
   if ($cont>=$totalpasta){ 

	   $pre = substr($str,6,10);
       echo "<td width=117>$raquo; <a href=video.php?video=".$str." target=leftFrame>".$pre."</a></td>"; 
   } 
   else{ 
       print "<td>&nbsp;</td>"; 
   } 
   $cont++; 
} 

//fecha o ponteiro aberto 
closedir($handle); 
?> 
</table>