Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have a requirement to delete old files based on date timestamp,
I found the component tFileProperties to fetch file properties
below is the sample job i have created by using the talend components
tFileList---iterate-- > tFileProperties ---main--->tMap-------main--->tfileDelte
On tMap schema editor i have used condition to check mtime in expression
((TalendDate.getCurrentDate()).getTime() - (Long)row1.mtime) > (8 * 24 * 3600000) to delete files based on above condition.
Can you please suggest any solution as per my requirement.
Thanks,
Prasanth
Hi
What is the problem with your current job design? Is the file deleted?
Regards
Shong
No, Job is running successfully but not deleting files based on condition. I'm not sure about the condition which i have applied.
if you just want to delete the files older than 48 hours, change the expression to
((TalendDate.getCurrentDate()).getTime() - (Long)row1.mtime) > (2 * 24 * 3600000)
Hi Shong I have tried the above condition already but not working.
Is there any issue in the work flow of my job?
Below is the attached schema for tMap.
please suggest me any other alternative solution.
Thanks Prasanth
Hi
The file name of tFileDelete component should be:
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
Can you check it?
Hi
It was not configured, but now i have added it in file name of tFileDelete and tested still not working.
I have tested your work flow and I am sure it works. Any error do you have? Try to output the filename on tMap to check if the filter condition is working.
Hi,
I have tested the work flow now all files are deleting even the condition is set to before 2 days files has to be delete from current date .
Just create a new file for testing, if the new file is deleted also, there must be something wrong in your job.