Helper function allowing to quckly change the extension of a file name
change_fileext(in_file, new_ext = NULL, new_path = NULL)
in_file |
|
---|---|
new_ext |
|
new_path |
|
character
basename/full_path of `in_file`` with updated extension
in_file = "home/lb/tmp/prova.tif" # return an updated full_path change_fileext(in_file, ".png")#> [1] "home/lb/tmp/prova.png"#' update both path and extension change_fileext(in_file, ".png", new_path = "/home/lb/new_path")#> [1] "/home/lb/new_path/prova.png"# return an updated basename change_fileext(in_file, ".png", new_path = "")#> [1] "prova.png"