Skip to content

Instantly share code, notes, and snippets.

@awwsmm
Created July 19, 2018 16:29
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 awwsmm/d1f6341c9f2bd0d28636dc321df5e609 to your computer and use it in GitHub Desktop.
Save awwsmm/d1f6341c9f2bd0d28636dc321df5e609 to your computer and use it in GitHub Desktop.
Merge CSV files with batch script (must have same columns)
@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