Windows - Combine multiple text files into a single text file

15

4

Possible Duplicate:
Any command-line or batch cmd to concatenate multiple files?

I have over a thousand text files which I would like to combine into a single text file, is there any way to do this automatically?

CLiown

Posted 2012-07-26T11:02:31.300

Reputation: 271

Question was closed 2012-07-26T11:21:40.327

more catchy title then the duplicated one, so +1 – Wolf – 2015-03-27T10:33:33.707

Are they all in the same directory? Do you have a list of the all the files? – Nifle – 2012-07-26T11:08:37.720

They are all in the same directory and I don't have a list of the file names. – CLiown – 2012-07-26T11:10:35.970

Then JC2k8's answer should do what you need. Don't forget to come back and accept it later if it does. – Nifle – 2012-07-26T11:12:24.223

Answers

23

Pull out your command line and let's go:

copy /a *.txt concat.txt

This will concatenate all txt files in the same directory into one file named "concat.txt".

/A indicates an ASCII text file

JC2k8

Posted 2012-07-26T11:02:31.300

Reputation: 2 813

short question, short answer +1 (only tiny blemish, the changing case of the /a) – Wolf – 2015-03-27T10:33:50.083

1The /a or /A option seems to be less useful then expected. I'm getting garbage line feeds in the concatenated file after the first file. Maybe this option is now outdated because many of alternative formats are around: you mostly think it's ASCII, but it isn't /b will do, if the last line ends with linefeed. – Wolf – 2015-03-27T10:46:52.570