I have a job in Talend which will connect to a folder and look for the current day's files (based on the name i.e. 20150928_MyFile, 20150928_MySecondFile and 20150928_MyThirdFile ) and will move these files to some other folder. I have used below flemask to look for today's file but this way Talend is moving all the files for today's date but I want it to move only the latest file of today's date for(20150928_MyFile, 20150928_MySecondFile and 20150928_MyThirdFile) each file to be moved. I have used the below FILE MASK -
((String)TalendDate.formatDate("yyyyMMdd", TalendDate.getCurrentDate())) + "*.CSV"
Thanks a lot in advance!!
You cant trust the current date based mask, because it not necessary to have a file in the NOW moment, but you can use tFileList to get last modified time and in each iteration, get the max last modified time:
tFileList-----(iterate)------tJavaRow
|
|
(OnSubJobOk)
|
.. [the rest of the job]