Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def file_exists(filename){
  2. try{
  3. return java.nio.file.Files.exists(java.nio.file.Paths.get(filename.toString()))
  4. } catch(e) {
  5. return false
  6. }
  7. }
  8.  
  9. def arquivo = "/path/do/meu/arquivo"
  10.  
  11. if(file_exists("${arquivo}")){
  12. echo "Arquivo existe"
  13. } else {
  14. echo "Arquivo não existe"
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement