There are certainly multiple ways to do this in CMD. The first way that comes to mind is to have a for-loop that runs for the total number of files. On every run, append the contents of the title file to a "merged" file, then append the contents of the articles file to that same file. Also, I'd recommend you have a file structure that looks like:
Parent Folder
|
|------------------|
| |
Titles Articles
In other words, have your folder with your titles and your folder with your articles sub-directories of the same folder. This will allow you to save this script in "Parent Folder," which will make directory browsing easier to follow.
@echo off
echo Starting...
setlocal EnableDelayedExpansion
REM Save the directory of "Parent Folder"
set parent_dir=!cd!
if not exist Merged md Merged
REM Initialize other directories
set titles_dir=!parent_dir!\Titles
set articles_dir=!parent_dir!\Articles
set merged_dir=!parent_dir!\Merged
REM However many files you have goes below
set NUMBER_OF_FILES=100
for /l %%a in (1, 1, !NUMBER_OF_FILES!) do (
for /f "tokens=*" %%b in (!titles_dir!\Title_%%a.txt) do (
echo.%%b>>!merged_dir!\Merged_%%a.txt
)
for /f "tokens=*" %%b in (!articles_dir!\Article_%%a.txt) do (
echo.%%b>>!merged_dir!\Merged_%%a.txt
)
)
echo Done
@echo on
And that's it. You should have fully merged titles and articles. I tested this with 100 generated text files. Here is my script for the test (the script was also saved the "Parent Folder" directory):
@echo off
echo Starting...
setlocal EnableDelayedExpansion
if not exist Titles md Titles
if not exist Articles md Articles
set parent_dir=!cd!
set titles_dir=!parent_dir!\Titles
set articles_dir=!parent_dir!\Articles
set NUMBER_OF_FILES=100
for /l %%a in (1, 1, !NUMBER_OF_FILES!) do (
echo Title%%a>!titles_dir!\Title_%%a.txt
echo ----->>!titles_dir!\Title_%%a.txt
echo. >>!titles_dir!\Title_%%a.txt
for /l %%b in (1, 1, 100) do (
echo This is article number %%a>>!articles_dir!\Article_%%a.txt
)
)
echo Done
@echo on
Just a quick note: This may be worth doing in a faster language, like C++, especially if you're working with a very large number of files.
Edit
I tested this script and was getting a little over 550 files/second generated per second from my initial test script that generated the Title and Article files.