Is it possible for the Jenkins pipeline function fileExist to handle wildcards

+1 vote
Can Jenkins pipeline function fileExist handle wildcards? I have created a zip file in the workspace folder in advance.
Jul 18, 2018 in Jenkins by Tyrion anex
• 8,700 points
12,974 views

3 answers to this question.

+1 vote

The fileExist step does not accept wildcards.

But, if you use the ‘Pipeline Utility Steps Plugin’, you can make use of the findFiles function which accepts wildcards.

An example:

def files = findFiles glob: '**/*.zip'
boolean exists = files.length > 0
answered Jul 18, 2018 by Sophie may
• 10,610 points
+1 vote

If you do not have the plug-in, you can use the shell "find". 

def exitCode = sh script: 'find -name "*.zip" | egrep .', returnStatus: true boolean exists = exitCode == 0
answered May 8, 2019 by Kalgi
• 52,360 points
0 votes

FileExists() does not support wildcards. FileFindFirst() does though, and you can check for a folder that way.

answered May 8, 2019 by Arya

Related Questions In Jenkins

+1 vote
1 answer
0 votes
2 answers

Is possible for Jenkins to auto start and stop slave nodes?

Try Jenkins Plugin called as Slave SetupPlugin. This ...READ MORE

answered Aug 6, 2018 in Jenkins by Nilesh
• 7,050 points
6,269 views
+3 votes
7 answers

Is it possible to shift or move jobs between two jenkins servers?

Hi, You can copy Jobs in between your ...READ MORE

answered Dec 16, 2020 in Jenkins by MD
• 95,440 points
44,363 views
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,439 views
+2 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

Unable to access Jenkins. I newly installed Jenkins but for some reason I cannot access it.

Try changing the port, Change JENKINS_AJP_PORT="xyz" to JENKINS_AJP_PORT="abc" If changing the ...READ MORE

answered Jul 4, 2018 in Jenkins by Sophie may
• 10,610 points
7,745 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP