0

How can I copy a file and save it to a new specified folder?

String pathOne = "path";
File file1 = new File(pathOne);

String pathTwo = "path";

save file1 to new directory

FareJump
  • 113
  • 2
  • 10
  • http://docs.oracle.com/javase/tutorial/essential/io/copy.html, http://docs.oracle.com/javase/tutorial/essential/io/move.html – Pshemo Dec 29 '15 at 23:50

1 Answers1

0

You can use apache commons library. It has FileUtils class that makes that kind of operations easy

https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html

in your case copyFile(File srcFile, File destFile) function is what you are looking for

George Moralis
  • 518
  • 2
  • 12