Skip to content

Instantly share code, notes, and snippets.

@mbierman
Last active August 11, 2022 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbierman/79d24a7c584fe432113ab038e35acf26 to your computer and use it in GitHub Desktop.
Save mbierman/79d24a7c584fe432113ab038e35acf26 to your computer and use it in GitHub Desktop.
exifRename.sh
#!/bin/bash
# requires:
# * https://formulae.brew.sh/formula/jq#default
# * https://formulae.brew.sh/formula/exiftool#default
for file in "$@"
do
date=$(exiftool -json "$file" | jq '.[] .CreateDate' | sed -e 's| |_|g' -e 's|:|.|g' -e 's|"||g')
echo renaming $file (${date})
mv "$file" ${date}_${file}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment