How to delete a file that is 5 years old.

One Star

How to delete a file that is 5 years old.

Hi,
I would like to ask help on how to delete a file that is 5 years older than its date modified.
Date Modified is in a file property
example:
If a file was created 2007 and it was last modified 2012. then this will be deleted.
Since I am not a Java man, i would like to know the script on this on tMAP or tFilterRow.
Thanks.
One Star

Re: How to delete a file that is 5 years old.

Hi
You can use tFilterRow and check Advanced mode.
TalendDate.compareDate(TalendDate.addDate(new Date(input_row.mtime_string),5,"yyyy"),TalendDate.getCurrentDate())==-1

tFileProperties-->tFilterRow-->tFileOutputDelimited
|
OnSubjobOk
|
tFileInputDelimited--row3-->tLogRow
|
Iterate
|
tFileDelete
Type row3.abs_path into "File Name" of tFileDelete.
Regards,
Pedro
One Star

Re: How to delete a file that is 5 years old.

Got it! thanks pedro.