One Star

[resolved] How to delete multiple files in HDFS?

Hi,
I was trying to delete multiple files using tHDFSDelete by specifying multiple file path seperated by comma(,). but it was not working. Later I saw generated code for tHDFSDelete then I came to know that I can't enter multiple file paths.
Is there any way in Talend to delete multiple files (may be in same or in different directory ) from HDFS?

Thanks,
Bhavesh
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] How to delete multiple files in HDFS?

Hi
Try to use tHDFSList to literate each file that you want to delete. For example:
tHDFSList--iterate--tHDFSDelete
There is a global variable that stores the current file path on tHDFSList:
(String)globalMap.get("tHDFSList_1_CURRENT_FILEPATH")
Set the file path of tHDFSdDelete with this variable.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
1 REPLY
Community Manager

Re: [resolved] How to delete multiple files in HDFS?

Hi
Try to use tHDFSList to literate each file that you want to delete. For example:
tHDFSList--iterate--tHDFSDelete
There is a global variable that stores the current file path on tHDFSList:
(String)globalMap.get("tHDFSList_1_CURRENT_FILEPATH")
Set the file path of tHDFSdDelete with this variable.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business