所有操作都是以fileSystem为入口进行,我们使用fileSystem下的delete方法进行删除文件操作,删除的时候必须慎重。
直接上代码:
/**
* 删除文件
* @throws Exception
*/
@Test
public void delete() throws Exception{
Boolean result = fileSystem.delete(new Path("/hdfsapi/test/jdk.zip"),true);
System.out.println(result);
}
每一步操作为什么都类似于之前,详解回顾:https://www.cnblogs.com/Liuyt-61/p/10737466.html