Skip to end of banner
Go to start of banner

How to remove pages that do not have specific labels using Confluence CLI

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 28 Next »

This article explains how to remove pages that do not have specific labels using Confluence CLI.

Instructions

Use runFromPageList action to run actions for each page from a page list and removePage to remove pages that do not have specific labels based on CQL

  1. Ensure that the CLI client file is updated with the required information. 
    Here is a screenshot of a sample space with pages and labels added to them. Page5 and page6 have label2 and label3 respectively.


  2. Run the CLI action which will remove the pages that do not have a specific label. In this example it is label1.

    --action runFromPageList --cql "space = "JSON" and label not in (\"label1\")" --common "-a removePage --id @pageId@"
    

    The output of the CLI action:

    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 


  • No labels