Skip to content

Instantly share code, notes, and snippets.

donaldmunro / copyFile
Created Jun 20, 2012 — forked from mrenouf/copyFile
Efficient file copy in Java (pre-JDK7)
View copyFile
public static void copyFile(File sourceFile, File destFile, final boolean isOverwrite) throws IOException {
if (destFile.isDirectory())
destFile = new File(destFile, sourceFile.getName());
if (destFile.exists())
if (isOverwrite)
throw new IOException(destFile.getAbsolutePath() + " exists");