This article explains how to remove pages , which that do not have any specific labels , using Confluence Command Line Interface (CLI).
Instructions
Use runFromPageList action to run actions to run actions for each page from a page list of pages and use removePage to remove use removePage to remove pages that do not have specific labels based on CQL.
...
.
...
For this example, consider a sample space with pages and labels added to them
...
; where pages, page5 and page6, have labels, label2 and label3, respectively. Here, the pages page5 and page6 that do not have the label label1,are removed from the space.
...
Ensure that the CLI client file is updated with the required information.
Run the below following CLI action which will to remove the pages that do not have a specific label. In the specified label (in this example it is label1., label1):
Code Block theme Midnight --action runFromPageList --cql "space = "'JSON"' and label not in (\"'label1\"')" --common "-a removePage --id @pageId@"
The In this example, the output of the CLI action is:
Code Block theme Midnight Run: -a removePage --id 30310402 Removed page 'page5' in space JSON. Run: -a removePage --id 30310404 Removed page 'page6' in space JSON. Run completed successfully. 2 actions were successful
page5 and page6 pages are now deleted from the given space as shown:
The parameters used with the above action are:
- --cql value refers to CQL content search.
- --id value refers to numeric ID of an item like a page.
Info |
---|
It is recommended to test the command in a non-production environment or run the action with the --simulate parameter to verify the behaviour before deploying. |