Getting 2 recent files from FTP & difference on output

Seven Stars

Getting 2 recent files from FTP & difference on output

Hello everyone,

 

I'm having some troubles finding a solution to my problem. Here it is : 

 

I have access to an FTP server where i want to get the 2 newer files (XML), compares them & only get the difference as an CSV output.
Some more details :

My files on my FTP always looks: TEXT_yyyyMMdd_hhmm   , like that :

TEXT_20180408_0950.xml
TEXT_20180409_0950.xml
TEXT_20180410_0950.xml

So here i would like to only extract the   TEXT_20180408_0950.xml   &    TEXT_20180409_0950.xml. If the files looks like that :

 

TEXT_20180408_0950.xml                                                             TEXT_20180409_0950.xml

 

<store>001</store>                                                                                      <store>001</store>
<ID>1</ID>                                                                                                   <ID>1</ID>
<qty>20<qty>                                                                                                  <qty>18<qty>
<price>3</price>                                                                                           <price>3</price>
<country>1</country>                                                                                   <country>1</country>
 

I want my output to be just : 

<store>001</store>                                                                                    
<ID>1</ID>                                                                                                  
<qty>18<qty>                                                                                            
<price>3</price>                                                                                          
<country>1</country>

But if the lines are exactly the same, I want nothing in my output, and if in the 08/04 files there is a line which is not anymore in the 09/04 files,I want the line with 0 as quantity.

I'm currently blocked at only get the 2 newer files, i used a tFileList with a tFileInputXML with : " (String)globalMap.get("tFileList_1_CURRENT_FILEPATH") " as FILENAME but I dont see how get the second one. If someone have some idea how I could do all this stuff.

Sorry for the long post, I tried to be as much specific as I can.

Really appreciate your time & help, 

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.