Description Usage Arguments Examples
Calls file.copy
under the hood but gives a message about the indices
and paths of the files that could not be copied.
1 | copy_files_to_target_dir(from_paths, target_dir, target_files)
|
from_paths |
paths to the files to be copied |
target_dir |
path to the target directory |
target_files |
relative paths to the target files, relative to
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | root <- system.file(package = "kwb.file")
relative_paths <- dir(root, recursive = TRUE)
# The original files are in root or in different subfolders
relative_paths
# Create a temporary target folder
target_dir <- kwb.utils::createDirectory(file.path(tempdir(), "target"))
# Copy all files into one target folder without subfolders
from_paths <- file.path(root, relative_paths)
to_paths <- basename(from_paths)
# Make sure that the target file names contain no duplicates, otherwise
# an error is raised
to_paths <- kwb.utils::makeUnique(to_paths, warn = FALSE)
# Copy the files
copy_files_to_target_dir(from_paths, target_dir, to_paths)
# Look at the result
dir(target_dir, recursive = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.