Search code examples
filetestingetltalenddata-extraction

How to create empty file if file does not exist


I want to retrieve files from a folder, while testing the existence of each of these files, and generate empty files if the file in question does not exist without displaying an error message. I am using the tFileExist component, while following the documentation on the official Talend website: https://help.talend.com/reader/Fa7iBFy6fRgEvdHqg85dYQ/QFh2k28YZ6scCHDV85SCkA. But the thing is that even if the file exists, it overwrites it and replaces it with an empty file.


Solution

  • I don't believe that example from Talend is correct: the description doesn't match what is being built.

    The "On Subjob Ok" branch is going to run as long as the tFileExist component runs ok, regardless of the result of that component. You would need to add a 2nd "if" branch to the tFileExist component (without the negation in the logic of the other if branch) and add the appropriate components to those 2 "if" branches. The "On Subjob Ok" branch can be deleted.