Manage Jenkins -> Script Console
def jobName = "Some_Job_Name" def maxNumber = 64 Jenkins.instance.getItemByFullName(jobName).builds.findAll { it.number <= maxNumber }.each { it.delete() }