CMD combine CSV files into one

I had the need to combine several CSV (excel) files into one file. The set was long enough that even opening them and copy/pasting would take over an hour. This little trick will do it in a few seconds. (in windows)

1. Put all of your files in the same folder. They all need to be CSV format and should be the only CSV files in the folder. You may want to remove headers from your spreadsheets if you don't want them later.
2. Open a command prompt. Windows+R > cmd This should be the normal command prompt because it doesn't work in powershell.
3. Navigate to the folder with your .csv files
4. type "copy *.csv newfilename.csv"
5. A new file named "newfilename.csv" will show up in the same folder. If you wanted to copy it somewhere else you could run copy *.csv path\newfilename.csv.

Example: copy *.csv %USERPROFILE%\Desktop\newfile.csv

This will copy all the CSV files from the folder you are in to a file on your desktop named newfile.csv. 

I'm sure this can also be done with any type of text-only file.

If you need to do it on another type of spreadsheet file, you'll want to save copies as CSV first.

Note: if you run this more than once, you will want to delete or move the newly created file before running again. Otherwise the new file will be copied in with the rest and you'll have a lot of duplicates.

I think this is where I found the original answer.


Popular posts from this blog

Simple powershell ping log with timestamp

DNS entries needed for MLB app

Lockdown Browser LAB SCCM deployment