One Star

FTP Most Recent File Get

Hey,
In Talend/Java: I need to get the most recent .zip file off a SFTP server. I know how to get a file with the current date, how do I get a file that is not the current date, but the one closest to the current date?
For example:
Today?s date is May 12, 2010
File On the SFTP:
20100510.zip
20100503.zip
20100427.zip
etc...
I only want to grab the 20100510.zip file and put it on my local drive. Then the next week a new file will appear (20100517.zip), and this job will be scheduled to run again, and I want it to grab that file....and so on and so on...
Any thoughts?
Attached is a screen shot with what I have now, which only gets the current date.
Thanks,
Ryan
4 REPLIES
Community Manager

Re: FTP Most Recent File Get

Hello
First, using a tFtpFileList to iterate each file, cut the file name and parse it to a date, hard code to get the newest date and return the file name.
Second, get the newest file from ftp server.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: FTP Most Recent File Get

I got the same problem. Can you give me a hint for the correct solution?
One Star

Re: FTP Most Recent File Get

Does anyone know, how to create a simple text file with current date in it. The file will contain just the current date. Every time the job runs successfully, a text file will be created with current date in it.
Community Manager

Re: FTP Most Recent File Get

Does anyone know, how to create a simple text file with current date in it. The file will contain just the current date. Every time the job runs successfully, a text file will be created with current date in it.

Dear xanworld
I have replied you on 18102
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business