public static void copyFile(File srcFile, File destFile) throws IOException {
    if (destFile.exists() && destFile.isDirectory()) {
      throw new IOException("Destination '" + destFile + "' exists but is a directory");
    }

    FileInputStream input = new FileInputStream(srcFile);
    try {
      FileOutputStream output = new FileOutputStream(destFile);
      try {
        copy(input, output);
      } finally {
        close(output);
      }
    } finally {
      close(input);
    }

    if (srcFile.length() != destFile.length()) {
      throw new IOException(
          "Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
    }
    destFile.setLastModified(srcFile.lastModified());
  }
Copy a file preserving the date.

@param srcFile the validated source file, must not be <code>null</code>
@param destFile the validated destination file, must not be <code>null</code>
@throws IOException if an error occurs
geode-core/src/main/java/org/apache/geode/internal/util/LogFileUtils.java