Reputation: 285
I need to verify multiple file existence in single when condition using && operation. check for any file that ends with .doc along with final.txt and proceed further. Second fileexistence(final.txt) seems to be working fine seperately. Please suggest on this
when {
expression
{
return (fileExists("""ls ${Path}/${version}/test/*.doc""")) && !(fileExists("""${Path}/${Version}/test2/final.txt"""))
}
}
Upvotes: 1
Views: 793
Reputation: 4678
You could use allOf and not
when {
allOf {
expression {
return fileExists("ls ${Path}/${version}/test/*.doc")
}
not {
expression {
return fileExists("${Path}/${Version}/test2/final.txt")
}
}
}
}
Upvotes: 2