Using the modResource->duplicate() method, but you have to use an instance of modX, not just xPDO.
In the MODx manager, when you right-click a folder resource, you can copy it and all of its children. How do you do that via the xPDO API?
// Get the resource to be copied
$masterdoc = $modx->getObject('modResource', 97);
// This will actually CREATE the doc.
$doc = $masterdoc->duplicate();