Hello Community ,
I need help plaiiiise
I wanna get all the recent file from a remote directory FTP to my local ,then delete this file from local after appload them to my Mysql Database:
the remote directory contain a CSV file withe the name like 20170515_Contact.csv (2017:year,05 month, 15 day)
every day there is the new files.
i wanna just get the file of the recent day.
this is my job : tftpconnection-->tftlistfile-->tftpget--tfileinputDelimeted-->tlogrow-->tmap--->mysqloutput
help me to configure all this component in order to get just the recent file to my local directory then delete them after having all the date at mysql
tFTPConnection-->tFTPGet--tFileInputDelimited-->tLogTow-->tMap--->tMysqlOutput (no tFTPFileList component).
To get the file for the current day from your FTP server, add a filemask with the following syntax:
TalendDate.formatDate("yyyyMMddHH",TalendDate.getCurrentDate()) + "_Contact.csv"
The component should look like this:
If necessary, define the local directory according to the place where you want to get the file with the tFileInputDelimited.
This is not really most resent file, as example most resent mean - You have 3 backup from same day, but need take latest
but Your tasks could be achieved with simple name patterns:
TalendDate.formatDate("yyyyMMdd",TalendDate.addDate(TalendDate.getCurrentDate() ,-1,"dd")) +"*.csv"
TalendDate.formatDate("yyyyMMdd",TalendDate.addDate(TalendDate.getCurrentDate() ,-1,"dd")) +"_Contact.csv"
use this pattern for tFTPFileList
@vapukov, I used the same for my job that has to fetch files from ftp server. The job works but doesn't get any files on to local directory despite them being on ftp. The date format on ftp is dd/MM/yyyy HH:mm:ss. Could that be the reason?
down vote The answer is that you probably can't do this using just wget or any other single tool that I am aware of. What you probably need to do is write a script that will use wget/curl/whatever that will request a directory listing from the ftp server. Then the script will select and retrieve the right file based on the file's name, or some other criteria Clean Master Facebook Lite Mathway