Many users will come into contact with text files in Windows on a daily basis. Whether it’s reading a Readme file, viewing system or application logs, editing configuration files or writing your own files. Text files can easily be viewed, created and edited using the built in Windows Notepad or more advanced programs like Notepad++. Making your own text file is simple and requires no coding or programming knowledge.
If you have a number of text files spread across your computer it can become a bit inconvenient to keep opening different files to read or edit specific text. What would make things easier is being able to merge a number of text files into one single file. This makes the text faster to read and search through. It’s especially useful for multiple logs or report files that could be spread across dozens or even hundreds of files.
Here we list 6 different tools and methods for you to be able to merge or combine multiple text based files into a single file to hopefully make things a little easier.
One advantage TXTCollector has over many other tools of this type is its ability to optionally include all the files inside subfolders and not just the main folder when merging. It also has a text filtering drop down box which can automatically add files of a specific type. They are BAT, LOG, XML, TXT, DAT, TAG, REG, INI, INF, HTM, CFG and CSV.
After installing TXTCollector, run it and browse for the folder containing your files, optionally include subfolders. All you have to do then is decide what type of separator to use, whether to add a simple line break between each text file or use no separation at all. Pressing Combine all files will ask you where to save the merged text file and what name to give it.
By default, TXTCollector cannot select all files but only files with specific file extensions. You can add custom extensions by clicking “Extensions and Separators” at the bottom and opening Extensions.txt in Notepad. Enter an asterisk (*) on its own line and then save the file. The extension drop down will now have a * which will select all files for merging. You can also add custom separators by editing the Separators.txt.
2. Text File Merge
While Text File Merge is an old tool dating to 2002, joining text files together isn’t complicated or operating system dependant and it still works fine today in Windows 10. It is a portable executable but comes as a Zip self extracting executable, so you need to browse for a folder and unzip the Text File Merge program before using it.
After browsing for the folder containing the text files, you can either press the Select All button, drag the mouse over a range of names or use Ctrl/Shift+Click to multi select. The box just below is for using a different extension filter such as *.log. The other options are for stripping lines from the top of text files or adding line spacing to the bottom. Each merged text file will be saved in the same folder with the name “merged file[number].txt”.
3. Text File Joiner
The website and developer of Text File Joiner is no longer around but the program still works and is simple enough to use. It’s only a 38KB standalone executable but the .NET Framework 4 is required which will need to be installed on Windows 7 and below operating systems.
Press button 1 to select and load the files and then button 2 to choose where to save the text file and what to call it. The order of files can be altered with the up and down buttons. You can also insert each file’s name and separate each text file with extra spacing. You have to select files to load and not whole folders so select everything in a folder or multiple files by using Ctrl+A or Shift/Ctrl+Click.
4. Use Notepad++ to Combine Multiple Text files
While the option to merge a number of text files into a single text file is not available as a standard feature in Notepad++, it can be added in by making use of the internal plugin system. It also works in a different way because only text files which are opened inside Notepad++ will be combined.
Firstly, download Notepad++ 32-bit version and install it or extract the portable version. Run the program and go to the Plugins menu > Plugins Admin. Find the Combine v1 plugin, check its box and click Install. After a compulsory restart of Notepad++, open all the files you want to merge and then go to Plugins > Combine > Start.
The Combine window will pop up and offer to insert the filename and a line of dashes before each text file and a line of asterisks with optional line feed after. By pressing OK a new text file will be created in Notepad++ with all opened text files combined, save it as a new TXT file. To rearrange the order of merged text, drag around the file tabs to the preferred order. The leftmost tab will be top, the rightmost will be the bottom text file.
Combine has a webpage where you can read more, download the plugin DLL separately or possibly make a donation if you find it useful.
Note: The Combine plugin does not work with the 64-bit version of Notepad++ and won’t be visible in the plugin list. It will also popup an error if you try to install the plugin manually. Make sure you use the 32-bit version of Notepad++, even if you are running a 64-bit Windows.
5. Merge Multiple Text Files Online
If your text files are relatively small and do not contain private or confidential information, using an online text file merging tool is a useful option. There are several online services out there that can merge text files. We’ll look at two that are essentially the same service with the same features, so you can use either one.
Visit Bear File Converter or Filemerge and you have the option of dropping text files onto the webpage, supplying a URL or browsing for files on your PC of up to 50MB.
Place files in a specific order using the sort area or delete them from the list. You can also add prefix text (before each file), suffix text (after each file), custom separator text, and choose between a DOS or UNIX output format. Then just press Merge and the new combined text file can be downloaded. The service also accepts around a dozen input file formats besides TXT but outputs only to TXT.
6. Merge Text Files Using Built-in Windows Tools
Windows has some methods to join multiple files together using command line tools such as Type and Copy. All you have to do is supply the right syntax to the command. For instance, open a Command Prompt, CD to the folder containing the text files and type:
Type *.txt > Combined.txt
That very simple command will read the contents of all the text files in the current folder and output it all to the combined text file. You can also do a similar thing with Copy:
Copy /b *.txt Combined.txt
The above will join all .TXT files together into one file called Combined.txt and has the same result as the Type command. The Copy command is quite powerful for joining files and you can join together just about anything including archives and video files. One drawback is if the text files don’t each have a line break at the end they will append directly onto the text from the previous file.
To stop that happening and split the text from each file with a line break you need to use something a bit more advanced:
For %f in (*.txt) do type “%f” >> Combined.txt & echo. >> Combined.txt
The above command will add an echo. after each file is copied into the text file which makes sure all text files start on a new line. Do note that you will need to change Combined.txt to a different file name if you run the command more than once in the same folder. Otherwise, all text files will simply append to the same file.
Add Line Breaks To The End Of Your Text Files
An option to make sure all your text files merge together properly is for each of them to contain a line break at the end. Then all methods will work without having to remember to add them yourself, even the simple Copy or Type commands.
Add a Line Break To All Files From The Command Line
This is a variation on the above command and will simply append a line feed to all TXT files in a folder.
For %f in (*.txt) do type “%f” & echo. >> “%f”
Add a Line Break To All Files Using Notepad++
Notepad++ is also able to easily add a new line to the end of text files using the Replace function. Load all text files into Notepad++, go to Search > Replace (Ctrl+H) and change the following:
Find what: (.*)
Replace with: \1\n
Search mode: Select “Regular expression” and enable “. matches newline”
Then press “Replace All in All Opened Documents” and all files will get a line feed at the end of the last line of text. This ensures anything appended to the text will start on its own line. Press Save All (Ctrl+Shift+S) to save all files when you’re finished.
Every subsequent press of the replace button will add another new line to each file. You can easily add 3 or 5 blank lines so separate files can be clearly recognized inside a long merged text file. Also, custom text can be added to the Replace with box after “\1\n”, such as “\1\n—END OF FILE—\n” or anything else you require.
Final Note: You might notice that if your files are numbered, sometimes they are not sorted in the proper numeric order. For example, the command line and some tools will order the files as file1, file10, file2 while Windows Explorer will order them as file1, file2, file10. The workaround is to pad the numbering with zero’s as file01, file02, file10 etc, which will add the files to the combined text file in proper numeric order.