Hi all,
Not sure if someone has done this here already, but I've created some R code to batch rename a folder of AudioMoth files to apply the date and time they were created. Hope this is of use to others:
#Convert filenames of AudioMoth to date and time of creation
library(tidyverse)
#Set directory to folder containing files
setwd("~/Dropbox (Baker Consultants)/AudioMoth_Rename") #Change this to wherever your files are located
Audiomoth_Dir <- "~/Dropbox/AudioMoth_Rename"
#Generate list of files present within the folder
file_list <-list.files(Audiomoth_Dir, pattern = "*.WAV", full.names = FALSE)
#Generate vector of creation dates and times
wav_file_info <- file.info(file_list)
new_names <- as.character(wav_file_info$mtime)
#Rename files
file.rename(from = file_list, to = str_c(new_names,".wav"))
You can also convert a folder of AudioMoth filenames to date/time format using a hybrid jscript/batch utility called JREN, written by Dave Benham.
The latest version of the code is available from GitHub at https://github.com/swingflip/Hakchi-Extra-Tools/blob/master/JREN.bat with Dave's notes from an earlier version at www.dostips.com/forum/viewtopic.php?t=6081
Copy the code into a text file and rename it to JREN.BAT then run it from a command window in the folder containing the files you wish to rename using the syntax:
jren "^([0-9A-F]{8})\.wav$" "ts({dt:('0x'+$1)*1000,tz:60,fmt:'{iso-dt}_{hh}-{nn}-{ss}.wav'})" /j /i
Note that the option "tz:60" defines timezone +60 minutes to convert UTC/GMT to BST - modify as necessary for your current timezone.
Best plan is to call JREN with the appropriate arguments (as above|) from a second batch file (eg jren_am.bat) and save both batch files in a folder somewhere on your Path (I put them in the C:\Windows folder). Then all you need to do is open a cmd window in the folder containing your files and run "jren_am" and all the filenames will be converted.
Another option is to use the free program Advanced Renamer from www.advancedrenamer.com, which will allow you to rename your files based on the date & time from the "Date Modified" tag (which includes seconds that are suppressed by Windows Explorer). However, whilst the AudioMoth Unix Epoch filename corresponds to the start of the recording, the "Date Modified" time appears to correspond to the time that the file was saved to the SD card at the end of the recording.