public static boolean copyFile(File source,File dest){
  File parentDest=dest.getParentFile();
  if (!parentDest.exists()) {
    if (!createDirectory(parentDest.getAbsolutePath())) {
      return false;
    }
  }
  try {
    Files.copy(source.toPath(),dest.toPath());
    return true;
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
}

public static boolean copyFile ( File source , File dest ) { File parentDest = dest . getParentFile ( ) ; if ( ! parentDest . exists ( ) ) { if ( ! createDirectory ( parentDest . getAbsolutePath ( ) ) ) { return false ; } } try { Files . copy ( source . toPath ( ) , dest . toPath ( ) ) ; return true ; } catch ( IOException e ) { e . printStackTrace ( ) ; return false ; } }
copy source file to destination file . create directory if destination directory does not exist
