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

Rodrigo Nascimento commented on IO-415:
---------------------------------------

I would like to work on this. Proposal:

1. FileUtils.moveFile(File, File, CopyOption...) currently always throws 
FileExistsException when the destination exists, even when 
StandardCopyOption.REPLACE_EXISTING is passed. copyFile(File, File, 
CopyOption...) honors that option. I propose that moveFile honors 
REPLACE_EXISTING too, and only throws FileExistsException when the option is 
absent.
2. Add FileUtils.moveFileToDirectory(File, File, boolean, CopyOption...), which 
passes the options to moveFile.

Calls without options keep the current behavior. I would add tests for: 
destination absent, destination present with and without REPLACE_EXISTING, 
rename and copy-and-delete paths, and createDestDir true/false.

Would a PR along these lines be acceptable?

> FileUtils#moveFileToDirectory() Overwrite Flag
> ----------------------------------------------
>
>                 Key: IO-415
>                 URL: https://issues.apache.org/jira/browse/IO-415
>             Project: Commons IO
>          Issue Type: Wish
>          Components: Utilities
>            Reporter: David Mollitor
>            Priority: Minor
>         Attachments: IO-415.patch
>
>
> Create a version of moveFileToDirectory() that accepts a flag to enable 
> overwrite.  If the destination file exists, copy over it.  Would require the 
> code to perform a buffer-by-buffer file copy instead of file#rename().



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to