1 2 1

HDFS文件名更改

  1 //文件名更改
  2 @Test
  3 public void testRename() throws IOException, InterruptedException, URISyntaxException {
  4 
  5 	//获取文件系统
  6 	Configuration configuration = new Configuration();
  7 	FileSystem fs = FileSystem.get(new URI("hdfs://192.168.12.161:9000"), configuration, "hadoop");
  8 	//修改文件名称
  9 	fs.rename(new Path("/qiuyun.txt"), new Path("/nanzhou.txt"));
 10 	//关闭资源
 11 	fs.close();
 12 }
 13 
posted @ 2019-10-08 15:38  NotFound-404  阅读(926)  评论(0)    收藏  举报