Is this issue intermittent by any chance ? I thought i got it working yesterday (the looping part) thanks to stackoverflow but it wont perform the loop today (on a friday!!!)
node('windows') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cca9c557-65b8-4c72-9176-f78d91c22907', url: 'g...@github.com:RocketScienceProjects/testrobocopy.git']]])
def paths = ['folder1', 'folder2', 'folder3']
def dirs = ['dst1', 'dst2', 'dst3']
[paths, dirs].transpose().each { pd ->
def path = pd[0]
def dir = pd[1]
bat "xcopy %cd%\\${path} C:\\${dir} /E /Y /V"
bat "(robocopy %cd%\\${path} C:\\${dir}\\temp lab.conf) ^& IF %ERRORLEVEL% LEQ 7 exit 0"
}
}
PS: please dont worry abt the batch commands, they doesnt make sense. i am just trying to get the loop rolling :)