Add Time to DateTimeOriginal/AllDates if filename would create a duplicate

Started by irinaonline, May 02, 2022, 04:32:29 PM

Previous topic - Next topic

irinaonline

Hi,

in my workflow, I rename my pictures with the following command:

exiftool.exe -fast2 -overwrite_original -m "-FileName<$EXIF:DateTimeOriginal $IPTC:OriginalTransmissionReference%%-c.%%ue" -d "%%Y%%m%%d %%H%%M%%S" -ext jpg -ext png -if "($EXIF:DateTimeOriginal) and ($IPTC:OriginalTransmissionReference) and (not $filename =~ /Testphoto/i)" "C:\Users\Leopold\GD\- Inbox"

In rare cases, I get a duplicate because the DateTimeOriginal is the same.

Is it possible for such a case to add 1 second to the DateTimeOriginal - or even more elegant to all dates - and rename it again, so there wouldn't be a duplicate issue?

StarGeek

I don't think this can be done in a single command due to the way exiftool operates.  The only thing I can come up with is doing something like padding the count so it's at least 5 digits, so it can be differentiated from the year, and then running a second command to increment the time.  And it would require another rename for the new time stamp.

Something like %-5c to get a 5 digit copy number.
Then
-if "$Filename=~/\d{5}\.(png|jpg)$/i" -Alldates+=0:0:1

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).