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