Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to pick latest file from specific file format.

Hello Talend Helpers, 

May you please help me for getting the current file from directory. Lets see the scenario 

In Directory we have below files. 

ACBACKLOG2017QTR1-RUNDT-FEB152017.txt
ACBACKLOG2016QTR4-RUNDT-FEB252017.txt
ACBACKLOG2016QTR3-RUNDT-FEB252017.txt
ACBACKLOG2016QTR2-RUNDT-FEB182017.txt
ACBACKLOG2016QTR1-RUNDT-FEB182017.txt


We need to create a logic to pic only current file. Here we have ACBACKLOG2017QTR1-RUNDT-FEB152017.txt as latest file, because its having latest 2017 QTR 1 data. 

Also need to make sure that we have already processed previous file before picking the latest one.


Thanks 
GopsK

Labels (2)
2 Replies
Anonymous
Not applicable
Author

Hi,
Here is a TalendHelpCenter:tFileList component which retrieves a set of files or folders based on a filemask pattern and iterates on each unity.
You can choose to prioritise the folder and file order either by using "Order" option.
Best regards
Sabrina
vapukov
Master II
Master II

Simplest logic:
[list=*]
  • process file

  • move processed file to archive folder (or rename it, or delete)


  • More intelectual - construct file name pattern for input component
    Like:

    "ACBACKLOG"+TalendDate.formatDate("yyyy",TalendDate.getCurrentDate())+"QTR"+((Integer.valueOf(TalendDate.formatDate("MM",TalendDate.getCurrentDate()))-1)/3+1)+"*.txt"