Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article explains how to remove pages which that do not have specific labels using Confluence Command Line Interface (CLI).


Use runFromPageList to run actions for each page from a list of pages and 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; thus, the page5 and page6 pages are removed from the space.


  1. Ensure that the CLI client file is updated with the required information. 

  2. Run the following CLI action to remove the pages that do not have the specified label (in this example, label1):

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

    In this example, the output of the CLI action is as follows:

    Code Block
    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 

    For this example, page5 and page6 pages are now deleted from the given space as shown:



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.