Skip to content

Instantly share code, notes, and snippets.

@superleeyom
Last active November 20, 2020 07:25
Show Gist options
  • Save superleeyom/a8b09e9a3e690270b2f5dd05e99630a8 to your computer and use it in GitHub Desktop.
Save superleeyom/a8b09e9a3e690270b2f5dd05e99630a8 to your computer and use it in GitHub Desktop.
Jenkins里利用groovy脚本获取指定文件夹名称
import static groovy.io.FileType.DIRECTORIES
def list = [""]
new File('/var/lib/jenkins/workspace/unprod').eachFile (DIRECTORIES) { file ->
def fileName = file.name;
if(fileName.startsWith('lumi_')){
list.add(fileName + "/");
}
}
return list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment