import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class HDFS_rename {
public static void main(String[] args) throws IOException {
//重命名文件
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
boolean flag = fs.rename(new Path("/usr/hadoop/test.txt"), new Path("/usr/hadoop/test_rename.txt"));
if(flag){
System.out.println("rename success");
}
else{
System.out.println("rename failed");
}
}
}
Hadoop——重命名文件
最新推荐文章于 2024-08-28 18:37:30 发布