I have about 12,000 .txt files. Most about 10mb in size. I need to join them all into one large text file. Mostly I use Notepad++ but the “combine” plug doesn’t work with it anymore. I’ve tried a couple freeware options but they freak out over the number and size. And trying to use the windows command line copy option freaks out, again because there’s so many. I know I could probably do a few at a time or just open each one and copy and paste into a file... but that will take forever. Is there any other way?!
2 Answers
If Notepad++ is not a hard requirement, you could use the COPY
command to do this. This will copy the contents of all .txt
files to a new file called output
:
copy *.txt output
If that does not work for whatever reason, you could try a short script such as this (save as a .bat
file in the same folder as the files you want to join):
if exist output del output
for %%a in (*.txt) do (
type "%%a" >> output
)
-
As I mentioned in my post. I’ve tried the copy option, it does not work. It freaks out part way through because of the size and number of files.– JasonCommented May 23, 2019 at 14:19
-
@Jason, Ah, somehow I missed that. Could you try the script I added?– BerendCommented May 24, 2019 at 6:09
-
How far does copy get? If it can handle say 1k files from 12k then you only need 12 manual operations.– MawgCommented May 24, 2019 at 7:54
As @Toto said in comments
If you have a linux machine, you could do:
cat *.txt > result.txt
Except that you no longer need a Linux box - Windows 10 also has a Bash shell, so install it and use the cat
command with wildcards to match all file names to be combined.
cat *.txt > result.txt
. A perl one-liner can also do the job,