Back up and rename the file or directory
Arguments
- path
path to a file or a directory
- remove
whether to remove the original path; default is false
- quiet
whether not to verbose the messages; default is false
Examples
path <- tempfile()
file.create(path)
#> [1] TRUE
path2 <- backup_file(path, remove = TRUE)
#> Moving file file19a5110a2d22
#> => file19a5110a2d22_[backup_20240503_181424]
file.exists(c(path, path2))
#> [1] FALSE TRUE
unlink(path2)