Created
September 29, 2018 15:00
-
-
Save akora/dde29866c07a595d1a40100c4f083e6d to your computer and use it in GitHub Desktop.
This script extracts Shutter Count information from Nikon NEF (RAW) files and saves the output into a CSV file (uses exiftool)
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 extracts Shutter Count information from Nikon NEF (RAW) files | |
# and saves the output into a CSV file (for further processing) | |
# Dependency: exiftool must be installed | |
# by Andras Kora, [email protected], 2018-09-29 Sat 16:18:37 CEST @638 | |
TIMESTAMP=$(date +%s) | |
FILENAME=$1 | |
# expecting the CSV file name as an argument | |
if [[ $# -eq 0 ]] ; then | |
echo 'This script extracts Shutter Count information from Nikon NEF (RAW) files' | |
echo 'Please specify the filename of the output CSV file' | |
exit 0 | |
fi | |
# Adding header info to the file | |
echo "Filename,ShutterCount" >> $FILENAME | |
# Extracting Shutter Count info from NEF (RAW) files | |
for i in *.nef ; do | |
echo "Processing $i" | |
echo -n "$i," >> $FILENAME | |
exiftool -*shuttercount* -s -s -s "$i" >> $FILENAME | |
done | |
# Adding timestamp (as Unix Epoch) to the file's basename | |
if [[ "$FILENAME" == *csv || *CSV ]] ; then | |
BASENAME=${FILENAME%????} | |
mv $FILENAME $BASENAME-$TIMESTAMP.csv | |
else | |
mv $FILENAME $FILENAME-$TIMESTAMP.csv | |
fi | |
echo "All Done" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment