You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "kapil soni (JIRA)" <ji...@apache.org> on 2014/06/28 11:11:24 UTC
[jira] [Updated] (IO-402) [IO] copyFileToDirectory - Over-Write
File
[ https://issues.apache.org/jira/browse/IO-402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
kapil soni updated IO-402:
--------------------------
Attachment: FILEUTILS_UNITTC_OVERWRITE.patch
FILEUTILS_OVERWRITE.patch
This is an approach to get this.
if overwrite flag is false ( which is by default true) then original file if exist is backed up with integer index at the end. for ex: somefile.txt.1 and so on.
I added patch for source and test both.
Please have a look.
Thanks
> [IO] copyFileToDirectory - Over-Write File
> ------------------------------------------
>
> Key: IO-402
> URL: https://issues.apache.org/jira/browse/IO-402
> Project: Commons IO
> Issue Type: Wish
> Components: Utilities
> Affects Versions: 2.4
> Reporter: BELUGA BEHR
> Priority: Minor
> Fix For: 2.5
>
> Attachments: FILEUTILS_OVERWRITE.patch, FILEUTILS_UNITTC_OVERWRITE.patch
>
>
> I came across a small annoyance at work today. I have code that takes a file and copies it to a mounted directory on a remote server. I am using FileUtils.copyFileToDirectory() to do the move, but it does not have an overwrite flag. If something goes wrong with the file transfer over the network, and only part of the file is transferred, all subsequent attempts are blocked by the fact that the file "already exists." I would like to see another overloaded copyFileToDirectory() method with a flag to overwrite the file if it already exists. The current behavior is to throw an IoException.
> Thanks!
--
This message was sent by Atlassian JIRA
(v6.2#6252)