How to use bash shell variable in exiftool command

Started by SampsonF, June 08, 2021, 04:45:35 AM

Previous topic - Next topic

SampsonF

I am trying to run this in a terminal:


EXIFCMD="TestName"
EXIFDIR="/var/vols/Pics"
exiftool -d %Y/week%W/%A \
   '-$EXIFCMD<${FileModifyDate}/%f%-c.%le' \
   -r $EXIFDIR


But I got this result:

Warning: No writable tags set from /var/vols/Pics/IMG_20180723_203020.jpg
Warning: Invalid tag name '${exifcmd}' - /var/vols/Pics/IMG_20180723_203020.jpg


My intention is to change EXIFCMD=filename after the dry run, and rerun the same command.

Phil Harvey

Maybe something like this:

EXIFCMD="TestName"
EXIFDIR="/var/vols/Pics"
exiftool -d %Y/week%W/%A \
   -$EXIFCMD'<${FileModifyDate}/%f%-c.%le' \
   -r "$EXIFDIR"


Here I have quoted $EXIFDIR in case a directory name contains spaces.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

SampsonF