1、Code -> GitHub
https://github.com/liufengji/hadoop_hdfs.git
2、Code
@Test
public void deleteAtHDFS() throws Exception{
// 1 創(chuàng)建配置信息對(duì)象
Configuration configuration = new Configuration();
FileSystem fs = FileSystem.get(new URI("hdfs://node1:9000"),configuration, "victor");
// 2 刪除文件夾 ,如果是非空文件夾,參數(shù)2是否遞歸刪除,true遞歸
fs.delete(new Path("hdfs://node1:9000/user/victor/output"), true);
// 3 關(guān)閉資源
fs.close();
}