Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bulk move pages based on last modified

Hello.

We recently installed power scripts add on in our confluence environment in preparation for a cleanup.

One item on our list is to move all pages that were last modified on or before 2015 are to be moved to a temporary space for about 6 months which afterwards would be deleted if none of the pages were claimed or screamed for.

I'm wondering if we can use power scripts for this and if possible what would the script look like (not being a developed or coder I'm a bit of a fish out of water here).

Thanks in advance.

1 answer

0 votes

Hello @Kathryn Smith ,

Create a space for keeping all archived pages. Get the id of the home page of this space.

Then you could create a script like this:

number archiveSpacePageId = 111011;

for (string s in getAllSpaces()) {
for (number p in selectPages("space = " + s)) {
if (p.updated < "2015-01-01") {
movePage(p, archiveSpacePageId);;
}
}
}

 archiveSpacePageId is the id of the home page of the space, which will keep all archived pages.

Wow thanks @Alexey Matveev _cPrime_ .

I do apologise. Is there a way this script to be altered to target a specific space to move pages from that were last modified 2015-01-01 rather than all spaces. EG: i have a space called 7. TRUCKS - can I test this script from this space to the archive space?

Annotation 2020-07-23 091940.jpg

I unfortunately I do not have a test confluence environment to test this out in and if i moved all the pages that this script would target then i would be impacting a live environment and i might lose my job!

Thanks you so much aswell - super appreciative.

Kat

@Kathryn Smith ,

You can write a script like this:

number archiveSpacePageId = 111011;
string sourceSpace = "7. TRUCKS";

for (number p in selectPages("space = " + sourceSpace)) {
if (p.updated < "2015-01-01") {
movePage(p, archiveSpacePageId);;
}
}
 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

216 views 2 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you