I would like to automate the publishing of articles in wordpress for my website. I have like the following files:
Is this already the solution in windows CMD?
C:\>For %f in (in*.txt) do type %f >> Combined.txt
(A FOLDER WITH 20.000 Titles)
- Title_1
- Title_2
- Title_3
- Title_4
- Title_5
(AND A FOLDER WITH 20.000 ARTICLES)
- Article_1
- Article_2
- Article_3
- Article_4
- Article_5
The numbers are associated with the respective file. That means title 1 belongs to article 1 and so on.
How can I automatically merge the title and the article number by number?
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:
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.
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):
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.