Reputation: 53
How to delete contents of the folder older then x days in Talend job?
I have thought about retrieving that attribute from rFilesList (could not find) or passing unix command to a system (less preferable way as you have less control).
Thank you!
P.S. The issue solved
Upvotes: 1
Views: 2946
Reputation: 64
Write a script to remove files over X days. and call the script from tSystem component : More about tSystem : https://help.talend.com/display/TalendOpenStudioComponentsReferenceGuide521EN/19.4+tSystem
Upvotes: 0
Reputation: 53
My solution (based on a link above): tFileList->iterate->tFileProperties (reads the file from previous step, ((String) globalMap.get ( "tFileList_1_CURRENT_FILEPATH")) )-> tMap has 2 outputs, based on mtime condition:
tFileDelete that deletes filesToDelete.filename
Upvotes: 1
Reputation: 1062
You can use a "tfilelist" coupled with a "tfileproperties". The variable mtime or mtime_string can help you.
Here there is a page that explain a little bit (but it's in french so you can google trad if you want) :
Upvotes: 1