package hadoop_do;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path;
public class Cpfile {
public static void main(String[] args) throws IOException{
Path source=new Path("/hulei/on1.txt");
Path target=new Path("/wang/");
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://hadoop1:8020");
System.setProperty("HADOOP_USER_NAME", "root");
FileSystem fs=FileSystem.get(conf);
FileUtil.copy(fs, source, fs, target,false,conf);
}
}