Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I've seen plenty of questions on this and almost every answer is "click and drag" which is not practical for hundreds of pages of varying hierarchy in a single Confluence space. There is one single unanswered question on this very topic that I could find: (https://community.atlassian.com/t5/Confluence-questions/How-to-move-multiple-pages-with-a-certain-label/qaq-p/995497)
The question is simple: Does Confluence (or Scriptrunner for Confluence) provide a method to move pages in bulk (with a certain label, e.g. "Archive") to another top-level page in the same Space?
None of the built-in scripts in "Scriptrunner for Confluence" provide even a clue on moving multiple pages. It's all adding labels, notifications, etc. Ok, that's great, but is there seriously no way to move all these unless by "click and drag"??
I have the first portion of my script running as a Job below, I just want to move these newly labeled pages to a new top-level page. Can anyone here please provide something beyond the template "click and drag" response, or is this just where Confluence is still at since 2004?
import com.atlassian.confluence.labels.Label
import com.atlassian.confluence.labels.LabelManager
import com.atlassian.confluence.labels.Namespace
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.scheduler.JobRunnerResponse
def labelManager = ComponentLocator.getComponent(LabelManager)
hits.each { page ->
def labelName = "Archive"
def label = labelManager.getLabel(labelName)
if (!label) {
label = labelManager.createLabel(new Label(labelName, Namespace.GLOBAL))
}
if (!page.labels*.name.contains(labelName)) {
log.info("Add label to page: ${page.title}")
labelManager.addLabel(page, label)
}
}
Import the class PageManager and then use one of the various move page methods.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.