Hadoop——重命名文件,
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");
}
}
}
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。