全部操做都是以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