Copy File NIO

Copy a File using Java NIO.

Javadoc available at https://www.javatapas.com/docs/javatapas/io/CopyFileNio.html


public static void copyFileNIO(String origFileName, String newFileName) throws IOException {

	Path originalFile = Paths.get(origFileName);

	Path copiedFile = Paths.get(newFileName);

	Files.createDirectories(Paths.get(copiedFile.getParent().toString()));

	Files.copy(originalFile, copiedFile, StandardCopyOption.REPLACE_EXISTING);

}