Skip to content

Instantly share code, notes, and snippets.

@moorchegue
Created June 4, 2025 13:52
Show Gist options
  • Save moorchegue/5b9c91768d2f698d2a06e3a799b8f48d to your computer and use it in GitHub Desktop.
Save moorchegue/5b9c91768d2f698d2a06e3a799b8f48d to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
FILE=$(realpath "$1")
OPTION="$(exiftool -G0 -a -s $FILE | grep -vP '\[(ExifTool|File|Composite)\]' | sed 's/\s{10} : / : /' | rofi -dmenu -i -l 30 -p "Select tag")"
if [ $? -ne 0 ]; then
echo "No tag selected"
exit
fi
TAG="$(echo $OPTION | awk -F ': ' '{print $1}' | sed 's/^\[\?/-/' | sed 's/\]/:/' | sed 's/\s\+//g')"
CURRENT_VALUE="$(echo $OPTION | awk -F ': ' '{print $2}')"
ALL_TAG_VALUES="$(exiftool -G0 -a -s $TAG $(dirname $FILE)/*.* | grep -v === | grep -v '^ ' | sort | uniq | awk -F ': ' '{print $2}')"
NEW_VALUE="$(echo "$ALL_TAG_VALUES" | rofi -dmenu -i -l 30 -p $(echo $TAG) -select $(echo $CURRENT_VALUE))"
if [ $? -ne 0 ]; then
echo "No value selected"
exit
fi
echo edit $TAG == $NEW_VALUE
exiftool -overwrite_original -sep ", " -m "$TAG"="$NEW_VALUE" $FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment