22.05.2024

Rename Nikon Voice Memos


After importing all images directly from the Nikon Z cameras over USB C using Image Capture/Digitale Bilder I rename all images with a leading date stamp

exiftool -d %Y%m%d_%H%M%S_%%f.%%e "-filename<datetimeoriginal" .

Unfortunately the voice memos recorded on the road keep their initial name. But here is a quick shell script how to rename also the voice memos accordingly

for wav_file in *.WAV; do
  bn1=$(basename "$wav_file" .WAV)
  matching_files=(*"$bn1"*.NEF)
  if [[ -e "$matching_files[1]" ]]; then
    for file in $matching_files; do
      bn2=$(basename "$file" .NEF)
      mv "$wav_file" "$bn2.WAV"
    done
  fi    
done