Skip to content

Instantly share code, notes, and snippets.

@gabrielem
Created October 8, 2014 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielem/118f7ebef5125dd3dab7 to your computer and use it in GitHub Desktop.
Save gabrielem/118f7ebef5125dd3dab7 to your computer and use it in GitHub Desktop.
<?php
function mergeFiles()
{
//Merge of files
foreach ($this->files_to_merge AS $T)
{
exec("> ".$this->csvPathTo.$T['dest']);
$count=0;
foreach ($T['source'] AS $Source)
{
if($count==0)
exec("cat ".$this->csvPathTo.$Source." > ".$this->csvPathTo.$T['dest']);
else
exec("tail -n +2 ".$this->csvPathTo.$Source." >> ".$this->csvPathTo.$T['dest']);
$count++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment