code: public static void copyFile(final File src, final File dest) throws IOException {
          if (src.isDirectory()) {
              // if the directory does not exist, create it
              if (!dest.exists()) {
                  dest.mkdir();
              }
  
              // get all the directory contents
              final String files[] = src.list();
  
              // Copy all the folders/files in the directory
              for (final String file : files) {
                  // construct the src and dest file structure
                  final File srcFile = new File(src, file);
                  final File destFile = new File(dest, file);
                  // recursive copy
                  copyFile(srcFile, destFile);
              }
          } else {
              // if its a file, then copy it
              final InputStream in = new FileInputStream(src);
              final OutputStream out = new FileOutputStream(dest);
  
              byte[] buffer = new byte[1024];
  
              int length;
              // copy the file contents
              while ((length = in.read(buffer)) > 0) {
                  out.write(buffer, 0, length);
              }
  
              // Clean up
              in.close();
              out.close();
          }
      }
docs: Copies a file or directory from one location to another location on a local system.<br /><br /> Note: The destination location must
  exist, otherwise a IOException will be thrown.
  
  @param src  The Source File or Directory to be copied to the dest location.
  @param dest The Destination location to copy the Source content to.
  @throws IOException Thrown if the destination location doesn't exist or there write permissions for the destination.