The code the way it stands would go in the same directory as the myformname.php.
What I did for testing was was create 3 forms. I then exported them all to the same directory. I ended up with csv1_exported, csv2_exported, csv3_exported and the merge_csv.php script all in the same folder. I then removed the _exported from each of the folder names.
The merge_csv.php script looked like this.
<?php
$files_to_merge = array(
"/csv1/csv1/storage/csv/form-results.csv", // form 1
"/csv2/csv2/storage/csv/form-results.csv", // form 2
"/csv3/csv3/storage/csv/form-results.csv" // form 3
);
$ftm = fopen("merged.csv","w+");
foreach ($files_to_merge as $file):
$fh = fopen("csv/" .$file, "r");
$line = false;
while (($data = fgetcsv($fh,8192,",")) != FALSE){
if (!$line){
$line = TRUE;
} else {
fputcsv($ftm,$data,",");
}
}
fclose($fh);
echo($file . "-". $count . "\n");
endforeach;
fclose($ftm);
?>
As you can see the script is looking one level deeper then the one I posted earlier. It all depends on what level of organization your looking for. I only do this to keep all the files for my forms separate. I'll then alter the embed script that the form builder generates to also look one level deeper because of the _exported name change.