One Star

Current File Path from tWaitForFile

I'm using the tWaitForFile component to get all files from a particular directory.  Files may exist in this directory prior to the start of my Job, and will certainly be added to this directory during the execution of my job.
Therefore, I have configured the tWaitForFile to "Include Present File" and "Trigger action when a file is created".
After finding a file, I need to read that file (using tFileInputDelimited), so I have connected to that component using an Iterate link - using Main to feed tFileInputDelimited does not seem to be possible.
So far, I have tWaitForFile --> Iterate --> tFileInputDelimited
However, to read the file, I need the full file path.  There does not appear to be a "safe" way to get this from the tWaitForFile component.  tWaitForFile sets a number of values that might be useful, but none is fully appropriate:

FILENAME - this is the current file, but only the file name itself - the path is not included.
PRESENT_FILE - this is the absolute path of the file, but only if it is a "pre-existing" file
CREATED_FILE - this is the absolute path of the file, but only if it is a "new" file
If I use FILENAME - I don't get the path, so I can't open the file.
If I use PRESENT_FILE or CREATED_FILE, I get the full path - but I have to guess which one to use for each file, since there's no variable set saying if the current file is "present" or "created".
Also, there appears to be a risk using CREATED_FILE; this is never set back to null after finishing processing all the pre-existing files, so it remains set to the path of a file that has already been processed.
Can anyone suggest a good way to get the correct full path to the current file from tWaitForFile?
Community Manager

Re: Current File Path from tWaitForFile

You can set the full path to the current file with this expression on tFileInputDelimited:
"your particular directory/"+((String)globalMap.get("tWaitForFile_1_FILENAME"))
Best regards
Talend | Data Agility for Modern Business