copy_dir
From pathological v0.1-1
by Richard Cotton
Copy the contents of a directory
Copies the contents of a directory, possibly recursively.
Usage
copy_dir(source_dir, target_dir, pattern = NULL, overwrite = FALSE, recursive = TRUE)
dir_copy(...)
Arguments
- source_dir
- String of directory to copy from.
- target_dir
- String of directory to copy to.
- pattern
- String regex or
NULL
. A filter for filenames, passed todir
. - overwrite
- Logical value. Should existing files be overwritten?
- recursive
- Logical value. Should subdirectories and their contents be copied?
- ...
- Passed from the defunct
dir_copy
tocopy_dir
.
Value
-
A logical vector of whether or not each file was successfully
copied is invisibly returned.
Note
Target directories that don't exist are created, silently (assuming write permission).
See Also
Examples
## Not run:
# #Copy subdirs by default
# copy_dir(R.home("etc"), file.path(tempdir(), "etc"))
# #Just copy the top level
# copy_dir(R.home("etc"), file.path(tempdir(), "etc2"), recursive = FALSE)
# #Now copy deeper levels, without overwriting.
# copy_dir(R.home("etc"), file.path(tempdir(), "etc2"), overwrite = FALSE)
# #Cleanup
# unlink(file.path(tempdir(), "etc"), recursive = TRUE)
# unlink(file.path(tempdir(), "etc2"), recursive = TRUE)
# ## End(Not run)
Community examples
Looks like there are no examples yet.