public static void copy(final File from, final File to) throws IOException { if (!from.isDirectory()) { final FileOutputStream fos = new FileOutputStream(to); try { copy(from, fos); } finally { close(fos); } } else { copyDirectory(from, to); } }