Combine text files into one with single command

Here is the simplest way you can combine multiple text files into one single file.
Lets say you have four text files a.txt, b.txt, c.txt and d.txt and you want to merge the contents of all the text files into one target.txt.


Command to merge multiple text files

To merge text files open the MS DOS command prompt and change the directory to where all files are stored. Now issue command :
copy *.txt target.txt
This will merge all the text files in the directory and create a new file named target.txt

44 Comments:

Anonymous said...

Excellent

HHUMAS said...

thanks....
excelent

Anonymous said...

Thanks!!

Anonymous said...

This worked great, thank you.

Anonymous said...

Perfect!

Anonymous said...

Thanks alot!

Anonymous said...

I've been looking for the best solutions in combining txt files. Finally found it...many thanks...

Anonymous said...

So simple! Why didn't I think of that??

Lee said...

Absolutely superb !! So simple yet so effective. Just what I needed :-)

Anonymous said...

Thanks.. Does the job perfectly ..Simple yet elegant

Anonymous said...

Good old DOS for the win!! Oh how I miss thee

Anonymous said...

just what i needed!

Anonymous said...

Is there a way to merge each file starting at a new line instead of a continuous string,

Anonymous said...

Saved me writing a script to do the same thing, thanks!

Hay Thật Shop said...

How to merge many text files in sub folder?

Geekonweb said...

Can you elaborate it little more? ( about subfolder )

Anonymous said...

excellent!!!! fantastic workflow

Anonymous said...

Perfect.. thanks

Anonymous said...

worked perfect. Thanks

Duncan Wanjohi said...

Brilliant! Thanks Geekonweb!

Anonymous said...

This is just what I was looking for.

EXCELLENT!!!!!!!!!!!!

Anonymous said...

is there a way of getting the file name in between of the combined files, to separate the files?

Anonymous said...

I still can't figure this out. How do I change the directory where the file is located?

Melissza said...

@Anonymous (Oct 25 2011)

I just tried this out and the file names were automatically inserted before the start of each file, on a new line and all. I didn't have to do anything special.

Anonymous said...

THIS IS AWESOME!!! Just Saved me so much hassle!!! Yahoo

Anonymous said...

I needed to combine 100+ scripts in 1 text file. This saved me a lot of time. Thanks!

Anonymous said...

Fantastic - thanks for the help!

Anonymous said...

Exactly what I needed, thanks!

Anonymous said...

Absolutely fabulous! Awesome!

..:: AvIzOnE™ ::.. said...

Super!!

Anonymous said...

Thank you so much!

Anonymous said...

Made my day!!!!! Thanks.

Anonymous said...

Wow..cool!! Thanks man..

Anonymous said...

How do you place the original file name between each bit of text? Be handy if you had a lot of user scripts and you wanted to search one main document, but to pick out indivdual scripts you needed to edit/delete later?

Anonymous said...

Save a lot of stress

Anonymous said...

If you are feeling lazy, you could just use an online utility such as merge-files-online.com

Anonymous said...

SIMPL E/Y GREAT TIP

Anonymous said...

Saved me a lot of hassle - can be used to combine html files as well.

Anonymous said...

This was immensely helpful. Thank you.

Anonymous said...

your the best

Anonymous said...

Wow, Amazing Works great I have tried with .nt file. if you need new line just put enter in the end of your each file then new merged file will start from new line

Anonymous said...

awesome thanks!

Anonymous said...

And you newbies to computing who weren't around when DOS was the top list in computing classes think that DOS isn't used anymore or is archaic.

Michael Babcock said...

Love it...good ol' DOS still does it best (and quickest).

Post a Comment