| file_save {fritools2} | R Documentation |
Create a Copies of Files
Description
I often want a timestamped copies as backup of files or directories.
Usage
file_save(
...,
file_extension_pattern = "\\.[A-z]{1,5}$",
force = TRUE,
recursive = NA,
stop_on_error = TRUE,
overwrite = FALSE
)
Arguments
... |
Paths to files. |
file_extension_pattern |
A Pattern to mark a file extension. If matched, the time stamp will get inserted before that pattern. |
force |
Force even if |
recursive |
Passed to |
stop_on_error |
Throw an exception on error? |
overwrite |
Passed to |
Value
A vector of boolean values indicating
success or failure.
See Also
Other operating system functions:
clipboard_path(),
file_copy(),
get_boolean_envvar(),
get_run_r_tests(),
is_installed(),
is_r_package_installed(),
is_success(),
is_windows(),
view(),
vim(),
wipe_tempdir(),
with_dir()
Other file utilities:
clipboard_path(),
delete_trailing_blank_lines(),
delete_trailing_whitespace(),
develop_test(),
file_copy(),
file_modified_last(),
find_files(),
get_lines_between_tags(),
get_mtime(),
get_unique_string(),
grep_file(),
is_files_current(),
is_path(),
paths,
search_files(),
split_code_file(),
touch()
Examples
f1 <- tempfile()
f2 <- tempfile()
try(file_save(f1))
touch(f1)
file_save(f1, recursive = FALSE)
f2 <- paste0(file.path(tempfile()), ".txt")
touch(f2)
file_save(f1, f2)
file_save(f1, f2)
file_save(f1, f2, overwrite = TRUE)
dir(tempdir())