question: public static void copyAll ( File root , File dest ) throws IOException { if ( root . isDirectory ( ) ) { for ( File child : root . listFiles ( ) ) { File childDest = new File ( dest , child . getName ( ) ) ; if ( child . isDirectory ( ) ) { if ( ! childDest . exists ( ) && ! mkdirs ( childDest ) ) throw new IOException ( "Failed to create dir " + childDest . getPath ( ) ) ; copyAll ( child , childDest ) ; } else { Files . copy ( child . toPath ( ) , childDest . toPath ( ) , StandardCopyOption . COPY_ATTRIBUTES ) ; } } } else { File childDest = new File ( dest , root . getName ( ) ) ; if ( ! dest . exists ( ) && ! mkdirs ( dest ) ) throw new IOException ( "Failed to create dir " + dest . getPath ( ) ) ; Files . copy ( root . toPath ( ) , childDest . toPath ( ) , StandardCopyOption . COPY_ATTRIBUTES ) ; } }
target:  Recursively copy every file/folder from root to dest