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

Emulate behaviour of cp when target is directory #102

jennybc opened this Issue Apr 19, 2018 · 2 comments


None yet
2 participants
Copy link

jennybc commented Apr 19, 2018

Any interest in emulating this aspect of cp (second line) in file_copy()?

cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory

source_file <- path(R.home("doc"), "THANKS")
target_directory <- dir_create("just_hold_me")
file_copy(source_file, target_directory)
#> Error: [EEXIST] Failed to copy '/Library/Frameworks/R.framework/Resources/doc/THANKS' to 'just_hold_me': file already exists

file_copy(source_file, path(target_directory, path_file(source_file)))
#> just_hold_me/THANKS

Created on 2018-04-19 by the reprex package (v0.2.0).

What if the first call to file_copy() "just worked", i.e. gave the result from the second call? We basically did this in googledrive and it seems nice. But I also had/have some misgivings that it's too helpful.


This comment has been minimized.

Copy link

jimhester commented Apr 19, 2018

I agree this should be supported, and we do support this for file_move(), it was just an oversight that it is not supported with file_copy().

@jimhester jimhester added the feature label Apr 19, 2018

@jimhester jimhester closed this in 5392b2d Jun 7, 2018


This comment has been minimized.

Copy link

jimhester commented Jun 7, 2018

Ok this should be fixed now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment