You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "tza (Jira)" <ji...@apache.org> on 2021/01/12 10:24:00 UTC

[jira] [Comment Edited] (IO-700) Provide FileUtils.moveFile(srcFile, dstFile, preserveFileDate)

    [ https://issues.apache.org/jira/browse/IO-700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17263219#comment-17263219 ] 

tza edited comment on IO-700 at 1/12/21, 10:23 AM:
---------------------------------------------------

Hi, thanks for the fast response.

I created a pull request which contains method overload, tests and additional javadoc for the moveFile which uses "copy and delete" if destination is another file system, could also results in the IOException if lastModified cannot be set.

 

[https://github.com/apache/commons-io/pull/185]


was (Author: tproko):
Hi, thanks for the fast response.

I created a pull request which contains method overload, tests and additional javadoc for the moveFile which uses "copy and delete" on other file system which also results in the IOException if lastModified cannot be set.

 

https://github.com/apache/commons-io/pull/185

> Provide FileUtils.moveFile(srcFile, dstFile, preserveFileDate)
> --------------------------------------------------------------
>
>                 Key: IO-700
>                 URL: https://issues.apache.org/jira/browse/IO-700
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: tza
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The current implementation 2.8.0 throws an Exception, if moveFiles or copyFiles (with preserveFileDate=true) cannot update the lastModifiedDate. This was not the case in 2.6.
>  
> For FileUtils.moveFile the copyFile(File, File) method is used, which results in a copy with preserveFileDate=true. Could you provide a method overload to moveFile similiar to copyFile.
>  
> {code:java}
> public static void moveFile(final File srcFile, final File destFile) throws IOException {
>   moveFile(srcFile, destFile, true);
> }
> public static void moveFile(final File srcFile, final File destFile, boolean preserveFileDate) throws IOException {
>   ...
>   copyFile(srcFile, destFile, preserveFileDate);
> }
> {code}
>  
> (We have a cifs mount where the server is not allowing the update)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)