ExifTool Forum

ExifTool => Newbies => Topic started by: Quant007 on May 04, 2020, 03:51:12 AM

Title: Get the filename create by exiftool
Post by: Quant007 on May 04, 2020, 03:51:12 AM
Hallo everyone,
I edit the exif via a arg-File. Here is it:

-charset
filename=latin
-ext
jpg
-overwrite_original
-DateTimeOriginal>ModifyDate
-DateTimeOriginal>CreateDate
-DateTimeOriginal>FileModifyDate
-DateTimeOriginal>FileCreateDate
-DateTimeOriginal>IPTC:DateCreated
#-DateTimeOriginal>IPTC:DigitalCreationDate
#-DateTimeOriginal>IPTC:DigitalCreationTime
-d
%Y-%m-%d_%H-%M-%S%%-c
-FileName<$DateTimeOriginal.%e
-FileName<$DateTimeOriginal-${title;tr/ /_/}.%e

Now the question: Is there a posibiliy to get the new filename, witch is created bei exiftool to use it further in a batchfile.
Thanks for any hints
Quant
Title: Re: Get the filename create by exiftool
Post by: Phil Harvey on May 04, 2020, 07:23:47 AM
The only thing I can think of is to add the -v option to the command, then capture the console output of the ExifTool command and search for a line like this:

'FROMFILE' --> 'TOFILE'

This will tell you the original name of the file and the new name.

- Phil
Title: Re: Get the filename create by exiftool
Post by: Alan Clifford on May 04, 2020, 03:07:10 PM
I've worked out a rather convoluted way to do this.  This uses bash but you should be able to convert it to a dos batchfile.

In the arg file, put the new file name into another tag that is not being used.  I've used artist.

Another invocation of exiftool puts the new file name into an environment variable

Another invocation of exiftool changes the file name

Et voilĂ , the new filename is available in the environment variable in the shell.

My file is called test1.jpg

My test.arg is


-artist=test2.jpg


My shell script is:


#!/bin/sh

oldname=${1}

ls -l test*
echo "myphotoenv:  ${myphotoenv}"

exiftool -@ test.arg ${oldname}

echo "oldname ${oldname}"
exiftool -a -G -artist ${oldname}

myphotoenv=`exiftool -s3 -artist ${oldname}`
echo "myphotoenv:  ${myphotoenv}"


exiftool '-filename<artist' ${oldname}


ls -l test*


I run:

./whatname.sh test1.jpg

Output is:


-rw-r--r--  1 alan  staff       18  4 May 19:21 test.arg
-rw-r--r--  1 alan  staff  4270416  4 May 19:59 test1.jpg
myphotoenv: 
    1 image files updated
oldname test1.jpg
[EXIF]          Artist                          : test2.jpg
myphotoenv:  test2.jpg
    1 image files updated
-rw-r--r--  1 alan  staff       18  4 May 19:21 test.arg
-rw-r--r--  1 alan  staff  4270416  4 May 19:59 test1.jpg_original
-rw-r--r--  1 alan  staff  4270416  4 May 20:01 test2.jpg