tFilelist get 2 out of 3 files (or more)

Seven Stars

tFilelist get 2 out of 3 files (or more)

Hello everyone,

 

Can anyone help me fix this : 

 

I'm trying to get the 2 most recent files from my SFTP out of 3 files in the directory. So i'm using a tFileList, listed by modification date. The order of files given by this component is right (checked with tLogRow). Tho, I have no idea how to only get the TWO most recent files out of it. Using " ((String)globalMap.get("tFileList_1_CURRENT_FILE")) " is only good for getting the 1st file. Here is my job : 

 

Sans titre.png

 

What i have tried in tJava_2 :

 

String array = ((String)globalMap.get("tFileList_1_CURRENT_FILE"));

java.util.ArrayList filesname_array =new java.util.ArrayList ();

filesname_array.add(array);

System.out.println(filesname_array);

But since I can only Iterate on tJava, it delete my ArrayList each time. So the println is right, but my array has only 1 value.... Can anyone help?

+ questions : Once i get those 2 files, any idea how to manage the output considering my job? 

THANKS A LOT

Tags (1)

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.