[resolved] How to delete multiple files in HDFS?

Highlighted
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

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

All Replies
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

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.