Codice PHP:
$handle opendir('/percorso/cartella');
while (
false !== ($file readdir($handle))) { 
  
$testo fread(fopen($file,'r'),filesize($file));
  
mysql_query("INSERT INTO tabella (testo,nomefile) VALUES ('$testo','$file')");
}
// questo è l'inserimento... si suppone che 
// a) i files siano in remoto
// b) la tabella in questione abbia 3 campi (id int auto_increment, testo text, nomefile varchar(50);

$query mysql_query("SELECT nomefile FROM tabella ORDER BY nomefile");
while (
$row mysql_fetch_array($query)) {
  echo 
$row['nomefile']."\n";
}
// questo ti stampa l'elenco di tutti i file in ordine alfabetico