Click Here to Turn Your Development Passion into a Real Career.

Combine Text Files into One File in Windows, Mac, and Linux

I ran into a problem where I had a zip file that had a document I wanted to copy split into 100 different .txt files. I needed to combine all of the text files into one large file so I could copy all the data.

Windows

You can combine text files in Windows using copy’s binary mode. From the command prompt navigate to the folder with the .txt files and run the following command:

copy /b filename* all.txt /b

Where filename* matches the pattern of your file names and all.txt is the output file.

Mac / Linux / Unix

You can combine files in the unix shell using cat and appending the output to a file:

cat filename* > all.txt

Where filename* matches the pattern of your file names and all.txt is the output file.

This should help save someone a lot of copy and pasting time.