You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/03/11 20:47:45 UTC

DO NOT REPLY [Bug 27615] New: - [IO] Last modified date not preserved in FileUtils.copyFile()

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27615>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27615

[IO] Last modified date not preserved in FileUtils.copyFile()

           Summary: [IO] Last modified date not preserved in
                    FileUtils.copyFile()
           Product: Commons
           Version: 1.0 Alpha
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: craig@maine.com


File copying using FileUtils.copyFile() does not preserve the last modified 
date in the copy. I'm not sure about other OS's, but preservation of the last 
modified date occurs when copying from Windows Explorer or the command window 
in a Windows environment. To add this feature to the class, just add the 
following line at the end of FileUtils.copyFile():
      destination.setLastModified(source.lastModified());
To unit test this change, add the following to the end of 
FileUtilsTestCase.testCopyFile1() and/or testCopyFile2():
        assertTrue("Check last modified date preserved", testFile1.lastModified
() == destination.lastModified());

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org