Originally published November 14, 2017 @ 10:52 pm

Long story short: old wiki is overloaded and broken; new wiki is not a wiki but SharePoint – a glorified file server; people are forced to improvise and put documentation on a WP wiki; bosses still want to see documentation in SharePoint; need a way to automatically sync new and updated posts from WP to SharePoint.

A couple of prerequisites to make this happen: the awesome wp2md utility and the pandoc package:

The default WP behavior when exporting posts is to prepend the filename with the date. Obviously, you want to remove this date prefix if you want exported posts to overwrite older files on SharePoint. The script does that.

This process is designed to run daily from cron and so it selects only those posts that have been created or modified in the past two days. You can adjust this as needed. You can download the script here.