Concatenating multiple text files into one file

If I have multiple text files in a folder (Folder A).  Does any one know through Windows scripting how to concatenate them into one file without maually cut and pasting?

Text3.txt                         to                     Text4.text (which has all the files)
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?
Gary DavisConnect With a Mentor Dir Internet SvcsCommented:
You could use the command-line copy command:

   copy Text1.txt + Text2.txt + Text3.txt  Text4.text

Gary Davis
I typically don't type spaces around the plus signs, to make it easier to see where the target file name starts.

If there's any chance of non-ASCII characters in one of the files, use the /b option for the copy command:
copy/b Text1.txt+Text2.txt+Text3.txt Text4.text.
If any file name contains one or more spaces, remember to surround the name with double quote characters ("):
copy/b "file name one.txt"+Text2.txt+Text3.txt Text4.text.
Steve KnightIT ConsultancyCommented:
You can also do

copy c:\someotherdir\*.txt C:\alldir\all.txt
(as otherwise all.txt would be included in the output!)

type c:\somedir\*.txt > c:\alldir\all.txt

or if you want a little header saying which file it is:

find /v "something-not-in-any-file zxzxcvbz" *.txt > all.txt
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.