Back up and rename the file or directory
Examples
path <- tempfile()
file.create(path)
#> [1] TRUE
path2 <- backup_file(path, remove = TRUE)
#> Moving file file17ff40c36c58
#> => file17ff40c36c58_[backup_20241220_174020]
file.exists(c(path, path2))
#> [1] FALSE TRUE
unlink(path2)