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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sun, 15 Nov 2009 10:09:52 -0500

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@web.de" <joehl@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.



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 15 Nov 2009 - 15:12:35 GMT

This archive was generated by hypermail 2.2.0 : Sun 15 Nov 2009 - 17:20:25 GMT