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 里也可以填写文件路径


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM