1 2 1

HDFS文件夹删除

  1 @Test
  2 public void testDelete() throws IOException, InterruptedException, URISyntaxException {
  3 
  4 	//1.获取文件系统
  5 	Configuration configuration = new Configuration();
  6 	FileSystem fs = FileSystem.get(new URI("hdfs://192.168.12.161:9000"), configuration, "hadoop");
  7 	//2.执行删除
  8 	fs.delete(new Path("/zxc.txt"),true);
  9 	//3.关闭资源
 10 	fs.close();
 11 }

new path 里也可以填写文件路径

posted @ 2019-10-08 15:09  NotFound-404  阅读(550)  评论(0)    收藏  举报