Rename camera trap files for upload in Agouti
rename_ct_files.Rd
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).
Usage
rename_ct_files(
foldername,
extensions = c("jpg", "png", "jpeg", "bmp"),
compile = FALSE
)
Details
This function will rename all files in the subfolders of the folder specified by foldername. If no foldername is provided, the user will be prompted to select a folder. The function will rename all files with the extensions specified in the extensions argument. The function will also compile all files in a single folder if compile is set to TRUE.
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)
# The function also works when no foldername is provided
rename_ct_files()
# The function can also compile all files in a single folder
rename_ct_files(foldername, compile = TRUE)
browseURL(foldername)
unlink(foldername,
recursive = TRUE)
} # }