How to bulk move child pages to new parent?

I had a page get corrupted and had to hard delete it from the database. I copied it before I did and wish to have its children moved to the copy. I ran the following SQL but it did not seem to change the heirarchy or have the new space home list the children:

update confancestors set ancestorid=74842628 where ancestorid=442;

Any idea how to accomplis this?

1 answer

1 accepted

This widget could not be displayed.
David Simpson Community Champion Jul 16, 2012

You could perhaps try out the Confluence CLI in Atlassian CLI.

Get a list of child pages for a page:

confluence --action getPageList --space "zconfluencecli" --title "Current Parent Page" --children

Then move each page in the list to a new parent...

confluence --action movePage --space "zconfluencecli" --title "This Child Page" --parent "New Parent Page"

It could be turned into a nice little bash script e.g.

move-page-children "Current Parent Page" "New Parent Page"

More CLI examples here

This looks promising but what about the fact that their parent page no longer exists?

Ideally, you should do this before you delete the parent ;). Another point that is too late for you is that in many cases you can use the CLI to save the source of the bad page, then update the page to correct the problem without deleting it.

I was able to get this working using the --outputFormat 2 for getPagelist and not supplying a title. I took all of the items (except the new home) with a parent id of 0 and used them to make the list. Thanks so much!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 30, 2018 in Confluence

How Manon Soubies-Camy uses Confluence + Trello to organize webinar notes and her knitting stash

@Manon Soubies-Camy is an engineer who has been an avid Atlassian user since 2014. She helps companies of all sizes transform the way they work with the Atlassian stack, including Jira and Confl...

847 views 8 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you