Concatenate text files with Windows command line, dropping leading lines
Solution 1:
more +2 file2.txt > temp
type temp file1.txt > out.txt
or you can use copy
. See copy /?
for more.
copy /b temp+file1.txt out.txt
Solution 2:
I use this, and it works well for me:
TYPE \\Server\Share\Folder\*.csv >> C:\Folder\ConcatenatedFile.csv
Of course, before every run, you have to DELETE C:\Folder\ConcatenatedFile.csv
The only issue is that if all files have headers, then it will be repeated in all files.
Solution 3:
I don't have enough reputation points to comment on the recommendation to use *.csv >> ConcatenatedFile.csv
, but I can add a warning:
If you create ConcatenatedFile.csv
file in the same directory that you are using for concatenation it will be added to itself.