private static boolean copyDir(File pFrom, File pTo, boolean pOverWrite) throws IOException {
        if (pTo.exists() && !pTo.isDirectory()) {
            throw new IOException("A directory may only be copied to another directory, not to a file");
        }
        pTo.mkdirs();  // mkdir?
        boolean allOkay = true;
        File[] files = pFrom.listFiles();

        for (File file : files) {
            if (!copy(file, new File(pTo, file.getName()), pOverWrite)) {
                allOkay = false;
            }
        }
        return allOkay;
    }
private static boolean copyDir ( File pFrom , File pTo , boolean pOverWrite ) throws IOException { if ( pTo . exists ( ) && ! pTo . isDirectory ( ) ) { throw new IOException ( "A directory may only be copied to another directory, not to a file" ) ; } pTo . mkdirs ( ) ; boolean allOkay = true ; File [ ] files = pFrom . listFiles ( ) ; for ( File file : files ) { if ( ! copy ( file , new File ( pTo , file . getName ( ) ) , pOverWrite ) ) { allOkay = false ; } } return allOkay ; }
Copies a directory recursively. If the destination folder does not exist,
it is created

@param pFrom the source directory
@param pTo the destination directory
@param pOverWrite {@code true} if we should allow overwrting existing files
@return {@code true} if all files were copied sucessfully
@throws IOException if {@code pTo} exists, and it not a directory,
or if copying of any of the files in the folder fails