开发者学堂课程【Hadoop 分布式文件系统 HDFS:修改文件夹名称】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/93/detail/1446
修改文件夹名称
目录
一.文件夹更名
二.示例
l 文件夹更名
@Test
public void testRename () throws IoException,
Inter ruptedException, URISyntaxException{// 1获取文件系统。Configuration configuration = new Configuration() ;
FileSystem fs = FileSystem. get (new
URI ("hdfs://hadoop102: 9000"),configuration,"atguigu") ;。// 2修改文件名称.fs. rename (new Path ("/banzhang. txt") Path("/banhua. txt")) ;+// 3关闭资源
fs.close()
l 示例
@Testpublic void testRename() throws IOException, InterruptedExcept ion, URISyntaxException{
// 1获取对象
Configuration conf = new Conf iguration();FileSystem fs = FileSystem. get(new URI("hdfs ://hadoop102:0,conf,”atguigu");
// 2执行更名操作fs. rename(new Path(" /banzhang. txt"), new Path("/yanjing. txt"));
// 3关闭资源
fs.close();