This article explains how to remove pages, which do not have any specific labels in a space using Confluence Command Line Interface (CLI).
Instructions
Use runFromPageList action to run actions for each page from a page list and use removePage to remove pages that do not have specific labels based on CQL.
...
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.