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