7

Using Talend, I want to verify if there is a file named ListePS.xls in my D:/ to do some treatment else nothing.

How do I check if file exists in Talend?

Kromster
  • 7,181
  • 7
  • 63
  • 111
user1805523
  • 179
  • 1
  • 2
  • 12

3 Answers3

11

you must use the component tFileExist with two outputs IF:

 ((Boolean) globalMap.get ("tFileExist_1_EXISTS")) for the case 1(File existence)
 ! ((Boolean) globalMap.get ("tFileExist_1_EXISTS")) for case 2 (non-existence of file)
amine ameur
  • 111
  • 3
8

In order to verify that a file exists, you can use the tFileExist component and connect to your conditional treatment with a Run If link.
For parameterization details and usage examples, you can consult the Talend documentation, available in your installation. In the Talend menubar, select Help > Help contents and then Talend User Documentation > Integration components > tFileExists.

Julien Boulay
  • 1,164
  • 7
  • 15
7

Design job like below

tFileExist----If(Exist)-------Use other Components 
        \
         \
          If(Not Exist) add other flow

Add below code in first IF condition ((Boolean) globalMap.get ("tFileExist_1_EXISTS")) and in second IF condition will be !((Boolean) globalMap.get ("tFileExist_1_EXISTS")) .

UmeshR
  • 803
  • 1
  • 9
  • 16