Description Usage Arguments Value Note See Also Examples
Copies the contents of a directory, possibly recursively.
1 2 3 4 |
source_dir |
String of directory to copy from. |
target_dir |
String of directory to copy to. |
pattern |
String regex or |
overwrite |
Logical value. Should existing files be overwritten? |
recursive |
Logical value. Should subdirectories and their contents be copied? |
... |
Passed from the defunct |
A logical vector of whether or not each file was successfully copied is invisibly returned.
Target directories that don't exist are created, silently (assuming write permission).
1 2 3 4 5 6 7 8 9 10 11 12 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.