To do this in PHP you would do something in the lines of:
- Open a file handle where the merged csv data can be written to
- Read all the filenames from the source dir
- For every file that ends with ".csv", append its content to the merge file
Ex.
$csvdir = './csvdir';
$result = fopen('./merge.csv', 'w');
if ($handle = opendir($csvdir)) {
while (false !== ($entry = readdir($handle))) {
if (substr($entry, -4) === ".csv") {
$csvcontent = file_get_contents($entry);
fwrite($result, $csvcontent);
}
}
closedir($handle);
}
fclose($result);