I use a homegrown shell script to publish my posts on this site. When I migrated to WordPress, I imported lots of existing posts and pages that I also wanted to be able to update with So, I wrote a script to generate the .blogpost files for those posts and pages:

The script isn’t too complicated. It just fetches all existing pages and posts from MySQL, finds the corresponding .txt files in the working directory, and generates corresponding .blogpost files using the post ids, types, titles, and permalinks stored in the database.

To run it, simply pass the same parameters you’d pass to mysql, e.g.

$ ./ -h [HOST] -u [USER] [DATABASE]

Leave a Reply

Your email address will not be published. Required fields are marked *