Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a zip files with dates as file name so i have to delete the files which are 5 days older to current date, how can i achieve this, i tried tfileproperties component from the forum which uses file creation date
is there a way where i can use file name date for deletion?
Thanks in advance,
lmit
Into a tJava component, use TalendDate.addDate to get the current date minus 5 days and TalendDate.formatDate to format the result as expected and store the result to a global variable:
globalMap.put("theDate", TalendDate.formatDate("yyyyMMdd", TalendDate.addDate(TalendDate.getCurrentDate(), -5,"dd")));
Then, use a tFileList component to get all file with the desired mask:
Finally, use tFileDelete to all corresponding files.
Hi All,
Thanks TRF for your suggestion i did as your suggested but only one file is getting deleted not the other files which are greater than 5.
It should all the zip files which are greater than 5 days
Thanks,
lmit
Hi TRF,
my file names will be 2020-03-10.zip
Please find the attachment for the job design.
in if link, the condition is
context.comapredate >=1
Thanks,
lmit