我可以使用以下代碼在簽出的 git repo 下找到檔案
stage('Clone and Upload') {
steps {
git branch: params.GIT_BRANCH, credentialsId: 'my-bitbucket-id', url: params.GIT_REPO
script {
def files = findFiles excludes: '', glob: ''
files.each { f ->
if (f.directory && f.name == 'MyScripts'){
echo "Folder: $f.name" // Prints Folder: MyScripts
}
}
}
}
}
但我想接下來列出“MyScripts”檔案夾中的所有檔案。我怎么做?
uj5u.com熱心網友回復:
您可以執行以下操作。
def files = findFiles excludes: '', glob: ''
files.each { f ->
if (f.directory && f.name == 'MyScripts'){
echo "Folder: $f.name" // Prints Folder: MyScripts
dir('MyScripts') {
sh "pwd"
def fileList = findFiles(glob: '*.*')
echo "$fileList"
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/492115.html
上一篇:將二維陣列取消嵌套到表中
