Created
March 22, 2015 20:27
-
-
Save mcjwsk/d84f41de1c04a3c0f078 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(-1); | |
ini_set('display_errors',1); | |
$iterator = new GlobIterator('dane/*.csv', FilesystemIterator::KEY_AS_FILENAME); | |
$data = iterator_to_array($iterator); | |
$j = 0; | |
foreach (array_keys($data) as $file) { | |
$content = file('dane/'.$file); | |
for($i =1; $i < count($content); $i++) { | |
$content[$i] = $file.';'.$content[$i]; | |
} | |
if ($j > 0) { | |
unset($content[0]); | |
} else { | |
$content[0] = 'PLIK;'.$content[0]; | |
} | |
//echo $file.'<br>'; | |
file_put_contents('dane.csv', implode('', $content), FILE_APPEND); | |
$j++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment