Open
Description
When doing a dir_copy()
to an empty destination folder the overwrite parameter produces different results.
In the example below we create the foo
dir that contains sub1
. Then, we copy foo
to newly created destinations dest
and dest_overwrite
with overwrite = FALSE
and overwrite = TRUE
respectively. I wouldn't expect the dir tree of the destination folders to defer, however, overwrite parameter affects the nesting of the directories
library(fs)
withr::with_tempdir({
dir_create("foo")
dir_create("foo/sub1")
dir_create("dest")
dir_copy("foo", "dest", overwrite = FALSE)
dir_create("dest_overwrite")
dir_copy("foo", "dest_overwrite", overwrite = TRUE)
print(dir_tree("dest"))
print(dir_tree("dest_overwrite"))
})
#> dest
#> └── foo
#> └── sub1
#> dest/foo dest/foo/sub1
#> dest_overwrite
#> └── sub1
#> dest_overwrite/sub1
Created on 2024-12-11 with reprex v2.1.0