Codice PHP:
$dir="cartella/che/contiene/i/file/"


if (is_dir($dir)) {
   if (
$dh opendir($dir)) {
      
$stringa="";
      while ((
$file readdir($dh)) !== false) {
             if(
$file!="." && $file!="..")
             {
                 
$stringa.=implode(""file($file));
             }
       }
       
closedir($dh);
   }
}
$stream=fopen("filenuovo.txt""w+");
fwrite ($stream$stringa);
fclose($stream);