increment_file_version | R Documentation |
If file does not exist, return the original path
increment_file_version(outpath)
outpath |
[chr] full path to file |
[chr] new path with version number appended (if necessary)
dir.create(tempdir(), recursive = TRUE, showWarnings = FALSE)
fname_old <- "test_file.csv"
file.create(file.path(tempdir(), fname_old))
list.files(tempdir()) # [1] "test_file.csv"
fname_new <- increment_file_version(file.path(tempdir(), "test_file.csv"))
file.create(fname_new)
list.files(tempdir()) # 1] "test_file_v1.csv" "test_file.csv"
file.remove(c(file.path(tempdir(), fname_old), fname_new))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.