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,320 points

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
• 9,900 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
• 50,840 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
• 6,920 points
+1 vote
5 answers

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

There are some Jenkins plugins out there ...READ MORE

answered Oct 25, 2018 in Jenkins by akaash
+4 votes
7 answers

How to set the pipeline name and description for a Jenkinsfile?

You can rename pipeline jobs in jenkins ...READ MORE

answered Oct 11, 2018 in Jenkins by Hannah
• 17,750 points
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,400 points
0 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
• 9,900 points