Get a list of filenames in a given folder in Jenkinsfile (Groovy)
问题 I cannot create a simple list of filenames in a given directory in a scripted Jenkins Pipeline. I tried many Groovy Script examples posted on SO and other forums but either the feature is blocked or I get method not found or whatever. This seems to be the easiest def DOCKER_FILES_DIR = './dockerfiles' // ... def dir = new File(DOCKER_FILES_DIR); def dockerfiles = []; dir.traverse(type: FILES, maxDepth: 0) { dockerfiles.add(it) } But this resolves the relative path incorrectly, so I get this