import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@SuppressWarnings("all")
public class CopyDemo1 {
public static void main(String[] args) {
Path p = Paths.get("D:/test/hello.txt");
Path p1 = Paths.get("D:/test/copy.txt");
Path p2 = Paths.get("D:/test/haha.txt");
try {
//复制文件p到p1
//Files.copy(p, p1);
//System.out.println("复制成功!");
//删除文件p1
//Files.delete(p1);
//System.out.println("删除成功!");
//移动文件
Files.move(p1, p);
System.out.println("移动成功");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}