How to copy file from one location to another location in Java?

530


I want to copy and paste a file from one location to another location in Java, Is there any one liner solution available?

1 Answer

6 years ago by

Files.copy(Paths.get("/from/location/foo.txt"), Paths.get("/to/location/foo.txt"));
6 years ago by Karthik Divi