1、Code -> GitHub
https://github.com/liufengji/hadoop_hdfs.git
2、Code
@Test
public void deleteAtHDFS() throws Exception{
// 1 创建配置信息对象
Configuration configuration = new Configuration();
FileSystem fs = FileSystem.get(new URI("hdfs://node1:9000"),configuration, "victor");
// 2 删除文件夹 ,如果是非空文件夹,参数2是否递归删除,true递归
fs.delete(new Path("hdfs://node1:9000/user/victor/output"), true);
// 3 关闭资源
fs.close();
}