ExifTool Forum

ExifTool => Newbies => Topic started by: SampsonF on June 08, 2021, 04:45:35 AM

Title: How to use bash shell variable in exiftool command
Post by: SampsonF on June 08, 2021, 04:45:35 AM
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.
Title: Re: How to use bash shell variable in exiftool command
Post by: Phil Harvey on June 08, 2021, 01:35:40 PM
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
Title: Re: How to use bash shell variable in exiftool command
Post by: SampsonF on June 08, 2021, 10:38:55 PM
Thank you very much!

It works.