private void moveFile(Configuration conf, String Path1, String Path2, String newname ) throws IOException {
FileSystem fs = FileSystem.get(conf);
FileStatus[] status = fs.globStatus(new Path(Path1+"cookie*"));
Path[] paths = FileUtil.stat2Paths(status);
for (Path i : paths) {
fs.delete(i, true);
}
Path dir = new Path(Path1); // Path1 對應的目錄不存在時,須要建立cookie
if(!fs.exists(dir)) fs.mkdirs(dir);get
status = fs.globStatus(new Path(Path2+"part*"));
paths = FileUtil.stat2Paths(status);
for (Path i : paths) {
FileUtil.copy(fs, i, fs, dir, false, conf);
}
Path f = new Path(newname);
if (fs.exists(f))
fs.delete(f, true);
fs.rename(new Path(Path1), new Path(newname));
}io