Function that rename camera trap files (i.e. photos) by appending folder name (e.g. 1000RECX) to file name (e.g. IMG0001) to create all unique file names across a deployment. Needed for deployments with more than 9999 pictures, so they can be uploaded in Agouti. This is a copy of the old rename_file_names() in the old fis-projecten (archived).

rename_ct_files(foldername, extensions = c("jpg", "png", "jpeg", "bmp"))

Arguments

foldername

DCIM folder to be treated

extensions

file extensions to be rename. Default is jpg, jpeg, bmp and png

Value

renamed picture files in the original folder

Author

: Lynn Pallemaerts and Someone Before Her

Examples

if (FALSE) { # \dontrun{
tempzip <- tempfile(fileext = ".zip")
fistools::download_gdrive_if_missing(gfileID = "1-84hbKouLKGwnLgBSRaQO1BnfogoFZWz",
                                     destfile = tempzip,
                                     email = Sys.getenv("email"),
                                     update_always = TRUE)

foldername <- paste0(tempdir(), "/test_case_renaming")
unzip(tempzip,
      exdir = tempdir())
rename_ct_files(foldername)
browseURL(foldername)
unlink(foldername,
       recursive = TRUE)
} # }