Bug 16576 - file.copy: copying a file to a directory using overwrite = FALSE does not copy the file (expected) but returns TRUE (expected FALSE instead)
Summary: file.copy: copying a file to a directory using overwrite = FALSE does not cop...
Status: RESOLVED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: I/O (show other bugs)
Version: R 3.2.2
Hardware: ix86 (32-bit) Windows 32-bit
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-10-22 14:05 UTC by roman.pahl
Modified: 2015-12-14 14:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description roman.pahl 2015-10-22 14:05:26 UTC
# R version 3.2.2 (2015-08-14) on a i386-w64-mingw32            


fn <- "file.txt"
file.create(fn)
## [1] TRUE

dir.create("some_dir")
file.copy(from = fn, to = "some_dir")
## [1] TRUE

file.copy(from = fn, to = "some_dir", overwrite = FALSE)
## [1] TRUE  # !!!unexpected - expected FALSE!!!

# Specifying the full path works as expected
file.copy(from = fn, to = file.path("some_dir", fn), overwrite = FALSE)
## [1] FALSE
Comment 1 Duncan Murdoch 2015-12-14 14:40:32 UTC
I've fixed this; soon to be committed in R-devel and R-patched.