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.
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 .
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);;
}
}
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.