[Rd] file.rename overwrites existing target (PR#14065)

Gabor Grothendieck ggrothendieck at gmail.com
Sun Nov 15 16:09:52 CET 2009


On Sun, Nov 15, 2009 at 9:58 AM, Jari Oksanen <jari.oksanen at oulu.fi> wrote:
> On 15/11/09 16:35 PM, "joehl at web.de" <joehl at web.de> wrote:
>
>> Full_Name: Jens Oehlschlägel
>> Version: 2.10.0
>> OS: Windows XP Professional
>> Submission from: (NULL) (85.181.158.112)
>>
>>
>> file.rename() will successfully rename file a to b - even if b exists already.
>> Though the documentation does not state what file.rename() will do in this
>> case,
>> I guess the expected behaviour is to fail and return FALSE.
>
> The *expected* behaviour is to overwrite the old file. Your expectation
> seems to be different, but overwriting or deleting the old file has been the

On UNIX the expected behavior would be to overwrite but on Windows the
rename command does not overwrite silently but fails so I think his
expectation is in line with how Windows works at the command line
level.  It might be worthwhile to have an overwrite= argument on
file.rename to control this.  If it defaulted to TRUE then the
expectation would be clear regardless of platform.



More information about the R-devel mailing list