Created
July 19, 2018 16:29
-
-
Save awwsmm/d1f6341c9f2bd0d28636dc321df5e609 to your computer and use it in GitHub Desktop.
Merge CSV files with batch script (must have same columns)
This file contains 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
@echo off | |
setlocal enabledelayedexpansion | |
set first=1 | |
set tmpFile=merged.csv.tmp | |
set outFile=merged.csv | |
if exist "%tmpFile%" del "%tmpFile%" | |
if exist "%outFile%" del "%outFile%" | |
>%tmpFile% ( | |
for %%F in (*.csv) do ( | |
if defined first ( | |
type "%%F" | |
set "first=" | |
) else more +1 "%%F" | |
) | |
) | |
ren "%tmpFile%" "%outFile%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment