diff --git a/list-top-level-items-controller.groovy b/list-top-level-items-controller.groovy new file mode 100644 index 0000000..6fa0320 --- /dev/null +++ b/list-top-level-items-controller.groovy @@ -0,0 +1,21 @@ +count = jenkins.model.Jenkins.instance.items.size(); + +println "TOP LEVEL ITEMS IN THE CONTROLLER: ${count}" +println "------------------" + +findItems(jenkins.model.Jenkins.instance.items.findAll(), "top-level"); + +def findItems(items, parentName) { + for (item in items) { + println "${parentName}/${item.name}" + if (item instanceof com.cloudbees.hudson.plugins.folder.Folder) { + println "items in ${parentName}/${item.name}: ${item.getItems().size()}"; + count += item.getItems().size(); + findItems(item.getItems(), parentName + "/" + item.name); + } + } +} + + +println "------------------" +println "TOTAL ITEMS IN THE CONTROLLER: ${count}" \ No newline at end of file