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,380 points
5,245 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
• 9,940 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
• 51,890 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,970 points
2,093 views
+1 vote
6 answers
+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,420 points
550 views
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,940 points
950 views