Issue
You want to locate Folders/Multibranch jobs that are empty and no longer contains any item inside.
Environment
-
CloudBees Core on modern cloud platforms - Managed controller
-
CloudBees Core on modern cloud platforms - Operations Center
-
CloudBees Jenkins Enterprise
-
CloudBees Jenkins Enterprise - Managed controller
-
CloudBees Jenkins Enterprise - Operations center
Resolution
Go to Manage Jenkins > Script Console
and copy/paste the following script. It will print the name of all folders and Multibranch jobs with no items inside.
import com.cloudbees.hudson.plugins.folder.Folder import com.cloudbees.hudson.plugins.folder.AbstractFolder Jenkins.instance.getAllItems(AbstractFolder.class).each { folder -> if (isEmpty(folder)) { println folder.fullName + " - " + folder.class } }; return def isEmpty(folder) { return folder?.items?.size() == 0 }