Hi guys,

I want to check if file exists with this groovy script:

flowfile = session.get()
if(!flowfile) return
file_path = flowfile.getAttribute('file_path')
File file = new File(file_path)
if(file.exists()){
session.transfer(flowfile, REL_FAILURE)
}
else{
session.transfer(flowfile, REL_SUCCESS)
}

and to route all files which exist to FAILURE relationship, but all of them go 
to SUCCESS, file is for sure in the folder
'file_path', I checked.

What am I doing wrong?

Thanks,

Tom

Reply via email to