Skip to content

Instantly share code, notes, and snippets.

@kuckmc01
Created October 27, 2022 20:32
Show Gist options
  • Save kuckmc01/29deeec4d01b0c20182dbc066c81a3aa to your computer and use it in GitHub Desktop.
Save kuckmc01/29deeec4d01b0c20182dbc066c81a3aa to your computer and use it in GitHub Desktop.
Simple groovy console script to delete all child nodes using resource resolver
def path ="/content/cq:tags/parent"
Resource resource = resourceResolver.getResource(path);
if (resource != null) {
def children = resource.getChildren();
children.each { child ->
resourceResolver.delete(child);
println "removed:"+child
}
}
resourceResolver.commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment