my-scripts/make_exif-name.sh

32 lines
1,015 B
Bash
Executable file

#!/bin/bash
# Add a exif-comment to all JPEG-Files from this directory and all subdirectorys
#
# (c) by Ulf Bartholomäus ub1x@gmx.net
VERSION="make_exif-name.sh Version 0.0.2 from 23.10.2005"
#
# Input: comment text
# Output: changed files
#
# Changes:
# 0.0.2: comment as parameter from commandline
# 0.0.1: generation
#
COMMENTSTEXT=$*
JPEGFILEFILTER=*.jpg
# trap is executed if script breaks
trap "echo '*** TRAP ***' ; exit" ERR
# check if command exists else break
which exiftran > /dev/null || echo "exiftran not found!" || exit;
echo "Write Comment: <"${COMMENTSTEXT}">"
# for each file in JPEGFILEFILTER do
# exiftran - transform digital camera jpeg images and use the libexif-Library
# -i Enable inplace editing of the images.
# -b Create a backup file when doing inplace editing.
# -p Preserve timestamps (atime + mtime) when doing inplace editing.
# -c <text> Set jpeg comment tag to <text>.
find . -type f -name "${JPEGFILEFILTER}" -exec exiftran -ibp -c "${COMMENTSTEXT}" {} \;