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,280 points
845 views

3 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+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,330 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 by Kalgi
• 36,260 points
0 votes

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

answered May 8 by Arya

Related Questions In Jenkins

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,900 points
508 views
+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
159 views
+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
• 14,080 points
4,593 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
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,330 points
125 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.