How to Split Large XML Files for WordPress [Quicktip]
When you want to migrate your WordPress to a new host or server, you may have trouble transferring your backup data, mostly existing content. You may have a large backup file but WordPress limits you to import backup files of only 2Mb in size.
There is no other way to complete the migration but to have your backup files sized less than 2Mb, which is almost impossible especially with files that have already exceeded the size. What you can do though is split the file into chunks of smaller sizes.
In this tutorial, we will show you how, using two different methods.
Splitting XML files on Windows
If you are on Windows, you can use WXR File Splitter.
Now go to the WXR File Splitter page and download the program. There is no installation required, you can use it immediately on your computer.
Once opened, you will see the WXR File splitter window. Click on the ‘Open WXR File’ button to import your large XML file, then click on the ‘Split File’ button to start splitting your large XML file.
Once the file is split, you will see the result in an opened window of the file location.
Splitting XML file on Mac
To split files on your Mac, you need to use a different and simpler script written in python called ‘mainSplit’.
Now go to the intro page and at the botton of the page, download mainSplit.py script. Make sure to download the file in (.py) extension and not (.txt) extension.
Once downloaded, open Terminal console that’s available from Application > Utilities folder on your Mac and enter the following line:
Running the line will open a small window of ‘WordPress XML Splitter’. Click on button ‘Browse File’ to select the XML file you want to split, and then select the folder you want the file to be saved to by clicking on ‘Browse Dir.’
When ready, click the ‘Start’ button and the processing will start immediately.
To check the split files, go to the directory you have selected earlier, and you will see a collection of files, not more than 2Mb in size each.
Both solutions on Mac and Windows are pretty much similar, although you are using different programs and scripts. The process is simple and fast, making your migration process easy with WordPress. There are many other ways to backup your WordPress files, but this approach of splitting XML files manually does not take a lot of your time.
Author: Mustaza Mustafa
Mustaza is a traveller, social media lover and a freelance web designer with years of experience working collaboratively over the Internet.