Last active
September 30, 2018 17:30
-
-
Save akora/80a6bdf2473ed25c9e09caf972f43bef to your computer and use it in GitHub Desktop.
This script renames ( << suggests new filenames) Nikon NEF (RAW) files based on shutter count and date & time information the photos were taken
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script renames Nikon NEF (RAW) files based on shutter count (EXIF "Shutter Count") | |
# and date & time information the photos were taken (EXIF "DateTimeOriginal") | |
# Dependency: exiftool must be installed | |
# by Andras Kora, [email protected], 2018-09-30 Sun 18:21:19 CEST @723 | |
for file in *.nef ; do | |
echo -n "Processing $file >> " | |
exif_shutter_count_info=$(exiftool -ShutterCount -s -s -s "$file") | |
formatted_shutter_count=$(printf "%08d" $exif_shutter_count_info) | |
exif_date_time_original_info=$(exiftool -DateTimeOriginal -s -s -s "$file") | |
date_time_array_split=($exif_date_time_original_info) | |
formatted_date_original=${date_time_array_split[0]//:/} | |
formatted_time_original=${date_time_array_split[1]//:/} | |
formatted_target_filename="$formatted_shutter_count-$formatted_date_original-$formatted_time_original.nef" | |
echo "Suggested new filename: $formatted_target_filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment