Reputation: 1989
Here is the folder structure I have.
Workspace folder: D:\Node\MyNode\
I need to do cd to the folder "xx_development" and this name xx can change for different strasms (RTC) but "_development" remains same.
how can I do cd to a folder with (*development) using a pipeline script?
Edit: I am using windows Nodes for Jenkins.
Upvotes: 0
Views: 182
Reputation: 259
To change the current directory to the folder with the pattern *_development, you can use the following script:
For Windows:
def folder = bat(returnStdout: true, script: 'dir /b /ad | findstr "_development"').trim()
bat "cd ${folder}"
For Linux:
def Folder = sh(returnStdout: true, script: 'ls -d */ | grep "_development"').trim()
sh "cd ${Folder}"
Upvotes: 1