Since the default behavior of file copying of attributes is OS
dependent, we give the new target file the current timestamp when
preserveFileDate is false.
MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
@@ -1401,10 +1401,7 @@ private static boolean doCopyFile(final File srcFile, final File destFile, final
// TODO IO-386: Do we still need this check?
checkEqualSizes(srcFile, destFile, srcFile.length(), destFile.length());
- if (preserveFileDate) {
- return destFile.setLastModified(srcFile.lastModified());
- }
- return true;
+ return destFile.setLastModified(preserveFileDate ? srcFile.lastModified() : System.currentTimeMillis());
}
//-----------------------------------------------------------------------

Since the default behavior of file copying of attributes is OS
dependent, we give the new target file the current timestamp when
preserveFileDate is false.