hdfs 文件名修改

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;


public class renameFile {
    
    
	public static void main(String [] args) throws IOException, URISyntaxException {
    
    
		FileSystem file = FileSystem.get(new URI("hdfs://Master:9000"),new Configuration());
		file.rename(new Path("/user/hadoop/file5.abc"), new Path("/user/hadoop/file5.txt"));
		file.close();
	}

}

猜你喜欢

转载自blog.csdn.net/NewDay_/article/details/108855947