Created
October 27, 2022 20:32
-
-
Save kuckmc01/29deeec4d01b0c20182dbc066c81a3aa to your computer and use it in GitHub Desktop.
Simple groovy console script to delete all child nodes using resource resolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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