Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dir_copy() gives diiferent results for overwrite parameter to empty destination #482

Open
AleKoure opened this issue Dec 11, 2024 · 0 comments

Comments

@AleKoure
Copy link

AleKoure commented Dec 11, 2024

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

@AleKoure AleKoure changed the title dir_copy gives diiferent results for overwrite parameter to empty destination dir_copy() gives diiferent results for overwrite parameter to empty destination Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant