You are not logged in.
Announcement
Unanswered posts
|
The Perl tFTPFileList is really missing in this situation. So instead of proposing a very complex solution, I've quickly coded tFTPFileList for Perl projects. You can find it on Talend Exchange: extension:191 (install it in your Talend Open Studio with the "Talend Exchange" view, it's all automatic).
I should have used a tSetGlobalVar instead of a tPerlRow, but unfortunately the auto-completed syntax $row[filename] is not available in this very place. I don't know why, I'll create a bug notification.
In the tPerlRow, we have:
$_globals{latest_file} = $input_row[filename];The most tricky method is how I generate the date_iso from the filename in the tMap:
join '', ($row1[filename] =~ m/(\d\d)(\d\d)(\d\d\d\d)/)[2,0,1]
tSortRow is useful to have the latest file on top of the list. tSampleRow let me take only the first row of my flow.
Hello Rodney
In fact, I am not a Perl programmer.
I know how to do that in Java, I will send this topic to our perl developper.![]()
Best regards
shong
Hi Shong,
I am confused on how to set the context variable and parse the date. Do I have to do this in a routine?
Hello friend
1)Define a context var called filemask in the job.
2)Use a tFTPFileList to iterate each file, parse the file name and cut the file name to get the string Date, eg:talend-08202009-->08202009, parse the string Date to a Date, and then compare this date to the current Date, get the most recent date, and set this file name to context var.
3)On tFTPGet, set the file mask with context var, eg: context.filemask
Best regards
shong
I use Perl version to gather files from FTP. How can I get the most recent file?
Example: today is 08262009
I have files in my FTP "talend-08232009 and "talend-08202009"
How do I write the FTPget and TFileList to find the most current file? i.e. "talend-08232009"