cancel
Showing results for 
Search instead for 
Did you mean: 

File name check during a BPM.

Former Member
0 Kudos

Hi All,

Can we configure the file sender/receiver adapter to just check whether a file with a particulat file name exists in a directory?

I want to do this check at a particular stage in BPM. If the file name is detected, I would like to proceed in a BPM.

Kindly assist.

Thanks,

John

Accepted Solutions (0)

Answers (3)

Answers (3)

rajasekhar_reddy14
Active Contributor
0 Kudos

refer below link

http://wiki.sdn.sap.com/wiki/display/XI/FileLookupin+UDF

Regards,

Raj

Former Member
0 Kudos

Hi,

No standard functionality exists in PI for only checking whether a file exists in a directory. you would need to use a UDF and the File I/O operations of java for this.

Regards

Former Member
0 Kudos

Hi,

How can the UDF code work in this case without a channel configuration?

Can you provide a sample UDF?

(java O/I function?)

Thanks,

John

Former Member
0 Kudos

Hi John,

You can use this code in the udf if the file directory is in the local file system



public String fileExists(Container container) throws StreamTransformationException{

   String FilePath = "C:\\FileName.txt";
   String reslt = "false";


   File f = new File(FilePath);  // You can even get this FilePath through function parameter as var1

   if(f.exists)
   {
      reslt = "true";
   }
   else
   {
      reslt = "false";
   }
 
   return reslt;

}

The function will return a string "true" if the file exists and "false" if not.

Regards,

Aravind

Former Member
0 Kudos

Hi ajay,

Thanks for the code.

Here you have given the local drive path.

The code would be very different for an ftp path.

Thanks,

John

Former Member
rajasekhar_reddy14
Active Contributor
0 Kudos

you can write one UDF to perfrom File look up, check in your directory whethe specific file exists or not.

search in sdn for piece of UDF code.

Regards,

Raj