1var source = new File("src/resources/bugs.txt");
2var dest = new File("src/resources/bugs2.txt");
3
4Files.copy(source.toPath(), dest.toPath(),
5 StandardCopyOption.REPLACE_EXISTING);
6
7//Source: http://zetcode.com/java/copyfile/
1import java.io.FileInputStream;
2import java.io.FileOutputStream;
3
4public class Main {
5 public static void main(String[] args) {
6 FileInputStream in =null;
7 FileOutputStream out=null;
8 try {
9 in=new FileInputStream(args[0]);
10 out=new FileOutputStream(args[1]);
11
12 int c;
13 while ((c=in.read())!=-1){
14 out.write(c);
15 }
16 }
17 catch (Exception e){
18 System.out.println("Error Copping File");
19 }
20 }
21}