How to programmatically duplicate a node?
Just unset the node ID with unset($node-&gt;nid), and node_save() will create a new node.

The code executed from node_save() is the following one:

// Insert a new node.
$node-&gt;is_new = empty($node-&gt;nid);
// ...
if ($node-&gt;is_new) {
  _node_save_revision($node, $user-&gt;uid);
  drupal_write_record('node', $node);
  db_query('UPDATE {node_revisions} SET nid = %d WHERE vid = %d', $node-&gt;nid, $node-&gt;vid);
  $op = 'insert';
}    


The last argument of drupal_write_record() is not passed; this means the function will not update an existing database row.

Once the node object has been saved with node_save(), $node-&gt;nid contains the node ID for the newly created database row.