Skip to content

Instantly share code, notes, and snippets.

@tjt263
Created December 30, 2017 07:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjt263/1247bc5fa5258d232c416a81c2464aeb to your computer and use it in GitHub Desktop.
Save tjt263/1247bc5fa5258d232c416a81c2464aeb to your computer and use it in GitHub Desktop.
Script for macOS & Canon EOS 650D. Prints the shutter count of the most recent image imported to the Photos.app library.
#!/usr/bin/env bash
lastimport()
{
find ~/Pictures/Photos\ Library.photoslibrary/Masters -type f -exec
stat -f "%m%t%Sm %N" {} + |
sort -rn |
head -1 |
cut -d\ -f5-
}
lastimport="$(lastimport)"
exiftool "$lastimport" |
awk '/File Number/ {print $4}' |
cut -d\- -f2
@tjt263
Copy link
Author

tjt263 commented Dec 30, 2017

This script will probably work with other, similar models from the Canon EOS DSLR lineup.
Particularly models that have an APS-C (<full-frame) sensor.

If it doesn't work with your particular model, let me know and I'll fix it ASAP.
I'll just need an example photo taken with your camera to analyze the EXIF metadata.
Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment