Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to retrieve the last 2 days worth of files from the remote ftp site when they have 5000 odd files present in the sftp site.I just want to sort the file list by desc order and get the last 2 days files alone into the local folder.
i am thinking if there is any way to implement it without using tbufferoutput and iterating through all the list of the files(5000) in the ftp site.Is there a quicker way to do this ,please help.
Please see the job flow below:
i am trying to read the ftpfile properties like the date and sort by desc and give the range and fetch the latest 2 days only.
Urgently need a better solution
Sorry man
In the File mask you have to put only ((String)globalMap.get("FileName")) so delete ( +".*" ) it works for me don't forget to set your distant directory and your local directory
Let me know if there is any problem
Thanks @houssem Boufaden it worked now and i was able to retrieve the files in the folder successfully,appreciate your help
Hello @Haresh Sivakumar please mark the comment 'as best' to help others
@houssem Boufaden so i just analyzed closer and figured that that tmap function i am using especially in the expression editor to filter out the files from the last 1 or 2 days,in this case just a day before based on mtime_string for the prior day but it is infact pulling in all the files beyond the 1 day (it is fetching last 3 days files -when i want just 1 day before files) TalendDate.diffDate(TalendDate.getCurrentDate(),TalendDate.parseDate("EEE MMM dd HH:mm:ss zzz yyyy",row8.mtime_string),"dd") <=1
What is incorrect here?
@Haresh Sivakumar try this one
TalendDate.diffDate(TalendDate.parseDate("yyyy-MM-dd",TalendDate.getDate("yyyy-MM-dd")),TalendDate.parseDate("EEE MMM dd HH:mm:ss zzz yyyy",row8.mtime_string)) <2
make sure that your pattern is correct
Awesome,worked now like a charm 🙂
Perfect !! 😄
good luck for you