Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
######################################################################
# Code from Francomano et al. (IBIS 2023) #
######################################################################
# Camera trap photo renaming script #
######################################################################
# Created by: Dante Francomano (dfrancomano@alumni.purdue.edu)
# Date: 20201003
######################################################################
######################################################################
# Determine original full paths
fullFilePaths<-list.files("/Users/dantefrancomano/Documents/Purdue/Dissertation/Pingüinos/Datos_de_Cámaras_Trampa/Relevant_Photos_SM_Style_Names",full.names=TRUE,recursive=TRUE)
# Extract path stems and site names
fullPathStems<-dirname(fullFilePaths)
siteNames<-sapply(fullPathStems,function(x) rev(strsplit(x,"/")[[1]])[2])
# Find modification dates and times, converting from PST to UTC-3 (Ushuaia time)
modificationDateTimes<-file.info(fullFilePaths)$mtime
attr(modificationDateTimes,"tzone")<-"America/Argentina/Ushuaia"
modificationDateTimes<-as.character(round(modificationDateTimes,"mins"))
# Convert times to YYYYMMDD_HHMMSS
cleanTimes<-gsub(":","",gsub("-","",sub(" ","_",modificationDateTimes)))
# Rename files
file.rename(fullFilePaths,paste(fullPathStems,"/",siteNames,"_",cleanTimes,".JPG",sep=""))