1

I have a problem: In my pipeline, I need to know if a certain file already exists. Here is my code :

if(...){
    bat 'if exist <insert file name here> (
             rem file exists
        ) else (
             rem file doesn't exist
        )'
}

I would like to know if I can get a return from that bat command so I could do something in my if(...) like : the return is true:do... or false:do...

Yuval Pruss
  • 8,716
  • 15
  • 42
  • 67
Emile
  • 592
  • 10
  • 36

1 Answers1

1

If you want to implement this directly in the pipeline script, you could use the code from the following question:

Check if a file exists in jenkins pipeline

Community
  • 1
  • 1
Ralf
  • 170
  • 1
  • 2
  • 11