That’s a little more complicated, and at that point you’re going to be best off writing your own PHP code to do it.
Craft has a bootstrap file that makes it very easy to write custom PHP code without going to the trouble of writing a plugin, which is great for one-off tasks like this.
Just create a new file alongside your index.php file, called move_entry.php. Here’s what it should look like:
Craft 3
<?php
// ...
// copy contents of index.php here, except for the last `$app->run();` line
// ...
// Start a transaction in case anything goes south
$transaction = $app->db->beginTransaction();
try {
// Fetch the entry you need to move
$entry = \craft\elements\Entry::findOne(184);
// Remove it from its old structure
$oldSection = $entry->getSection();
$record = \craft\records\StructureElement::findOne([
'structureId' => $oldSection->structureId,
'elementId' => $entry->id
]);
if (!$record->deleteWithChildren()) {
throw new \Exception('Could not delete the old structure node');
}
// Set the new sectionId and typeId on the entry
$entry->sectionId = 2;
$entry->typeId = 2;
// Append it to the end of the new structure
$newSection = $entry->getSection();
if (!$app->structures->appendToRoot($newSection->structureId, $entry, 'insert')) {
throw new \Exception('Could not insert the new structure node');
}
// Save the entry
if (!$app->elements->saveElement($entry)) {
throw new \Exception('Could not save the entry');
}
// Commit the transaction
$transaction->commit();
} catch (\Exception $e) {
// Undo whatever changes we already made
$transaction->rollBack();
throw $e;
}
echo 'success!';
Craft 2
<?php
namespace Craft;
// Initialize Craft without letting it take over the whole request
$app = require '../craft/app/bootstrap.php';
// Set Craft to Craft Personal so we don't get any errors about Client/Pro-only components not being available
$app->getInfo()->edition = 0;
// Start a transaction in case anything goes south
$transaction = $app->db->beginTransaction();
try
{
// Fetch the entry you need to move
$entry = $app->entries->getEntryById(184);
// Remove it from its old structure
$oldSection = $entry->getSection();
$record = StructureElementRecord::model()->findByAttributes(array(
'structureId' => $oldSection->structureId,
'elementId' => $entry->id
));
if (!$record->deleteNode())
{
throw new Exception('Could not delete the old structure node');
}
// Set the new sectionId and typeId on the entry
$entry->sectionId = 2;
$entry->typeId = 2;
// Append it to the end of the new structure
$newSection = $entry->getSection();
if (!$app->structures->appendToRoot($newSection->structureId, $entry, 'insert'))
{
throw new Exception('Could not insert the new structure node');
}
// Save the entry
if (!$app->entries->saveEntry($entry))
{
throw new Exception('Could not save the entry');
}
// Commit the transaction
$transaction->commit();
echo 'success!';
}
catch (\Exception $e)
{
// Undo whatever changes we already made
$transaction->rollback();
throw $e;
}
Plug the right entry/section/type IDs in there, point your browser to http://example.com/move_entry.php and you should be all set!
Warning: Make sure you never run this code for an entry that has any children in the structure, as its children will end up getting removed from the hierarchy.