全部操做都是以fileSystem为入口进行,咱们使用fileSystem下的delete方法进行删除文件操做,删除的时候必须慎重。html
直接上代码:编程
/** * 删除文件 * @throws Exception */ @Test public void delete() throws Exception{ Boolean result = fileSystem.delete(new Path("/hdfsapi/test/jdk.zip"),true); System.out.println(result); }
每一步操做为何都相似于以前,详解回顾:http://www.javashuo.com/article/p-fytowmgb-ge.htmlapi