Get the filename create by exiftool

Started by Quant007, May 04, 2020, 03:51:12 AM

Previous topic - Next topic

Quant007

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

Phil Harvey

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
...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 ($).

Alan Clifford

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