copy_dir

0th

Percentile

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 to dir.
overwrite
Logical value. Should existing files be overwritten?
recursive
Logical value. Should subdirectories and their contents be copied?
...
Passed from the defunct dir_copy to copy_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

basename

Aliases
  • copy_dir
  • dir_copy
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)
Documentation reproduced from package pathological, version 0.1-1, License: Unlimited

Community examples

Looks like there are no examples yet.