osf_cp {osfr} | R Documentation |
Copy a file or directory
Description
Use osf_cp()
to make a copy of a file or directory in a new location.
Usage
osf_cp(x, to, overwrite = FALSE, verbose = FALSE)
Arguments
x |
An |
to |
Destination where the file or directory will be copied. This can be one of the following:
|
overwrite |
Logical, if a file or directory with the same name already
exists at the destination should it be replaced with |
verbose |
Logical, indicating whether to print informative messages
about interactions with the OSF API (default |
Details
Note that a file (or directory) cannot be moved or copied onto itself, even
if overwrite = TRUE
.
Value
An osf_tbl_file
containing the updated OSF file.
See Also
Other OSF file operations:
osf_mkdir()
,
osf_mv()
,
osf_rm()
Examples
## Not run:
project <- osf_create_project("Flower Data")
write.csv(iris, file = "iris.csv")
data_file <- osf_upload(project,"iris.csv")
# Create a new directory to copy our file to
data_dir <- osf_mkdir(project, "data")
# Copy the file to our data directory
data_file <- osf_cp(data_file, to = data_dir)
# Copy directory to new component
data_comp <- osf_create_component(project, title = "data", category = "data")
data_dir %>%
osf_cp(to = data_comp) %>%
osf_open()
## End(Not run)
[Package osfr version 0.2.9 Index]