Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@AleKoure

Description

@AleKoure
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.