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 

猜你喜欢

转载自www.cnblogs.com/nan-qiu/p/11635732.html