Did my first WordPress import today using wp-cli. After unzipping the export file, I was looking at 157 xml files. Seemed plausible I could just point wp-cli import to the folder containing them, but all I got was an error: This does not appear to be a WXR file, missing/invalid WXR version number.
Fortunately, I recently began working at 10up and am surrounded by tons of brilliant people willing to lend a hand. The first suggestion I got after finding out I couldn’t point wp-cli to a folder was you can write a super simple bash script to hit each file in a directory. ‘Great’ I thought, but before I could even open one of my many PDFs on shell scripting I had an email with a pre-made script that only needed minor adjustments to work for what I needed. And while I was contemplating those adjustments, I got another message, in HipChat this time. And this time with nearly exactly what I needed.
for f in dir/*.xml; do wp import $f --authors=skip --skip=attachment --url=mysite.dev/; done
I sure miss being a Stay-at-Home Dad, but I sure love doing this job!