ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Gorrunyo on March 11, 2024, 01:05:14 AM

Title: Increment the creation date using the sequence number in the file name
Post by: Gorrunyo on March 11, 2024, 01:05:14 AM
I'm using a tool that sorts images by creation date.
I have a bunch of negatives I scanned, all with the same creation date and with file names like this:

place_001.jpg
place_002.jpg
...

the goal would be to increment the creation date using the sequence number in the file name so the application will sort them in the right sequence.

My question is why this command line is not working?

exiftool -datetimeoriginal+="0000:00:00 00:00:${Basename;m/^[^_]+_([\d]+)$/;$_=$1}" .\place_001.jpg
    0 image files updated
    1 image files unchanged



I'm sure there is a better method to do what I need

Thanks
Title: Re: Increment the creation date using the sequence number in the file name
Post by: Phil Harvey on March 13, 2024, 03:18:15 PM
I assume you are on Windows CMD because of the quoting.

This is common mistake 5c (https://exiftool.org/mistakes.html#M5).  Use "+<" instead of "+=".

- Phil
Title: Re: Increment the creation date using the sequence number in the file name
Post by: Gorrunyo on March 13, 2024, 10:15:41 PM
Thanks for the reply,

Yes, I'm using Windows, but I can run it on Linux too.
Somehow, this doesn't seem to go through either

exiftool -datetimeoriginal .\place_001.dng
Date/Time Original              : 1993:07:03 02:49:10

exiftool "-datetimeoriginal+<0:0:${Filename;m/^[^_]+_([0-9]+).+/;$_=$1}" .\place_001.dng
Warning: No writable tags set from ./place_001.dng
Warning: Invalid tag name '0:0:'. Use '=' not '<' to assign a tag value - ./place_001.dng
    0 image files updated
    1 image files unchanged
Title: Re: Increment the creation date using the sequence number in the file name
Post by: Gorrunyo on March 14, 2024, 03:26:40 AM
It seems to work on Linux

exiftool '-datetimeoriginal+<0:0:${Filename;m/^[^_]+_([0-9]+).+/;$_=$1}' ./place_001.dng
    1 image files updated

Thanks
Title: Re: Increment the creation date using the sequence number in the file name
Post by: StarGeek on March 14, 2024, 04:05:43 PM
Quote from: Gorrunyo on March 13, 2024, 10:15:41 PMYes, I'm using Windows, but I can run it on Linux too.
Somehow, this doesn't seem to go through either

Warning: Invalid tag name '0:0:'. Use '=' not '<' to assign a tag value - ./place_001.dng

I'm guessing that you're using PowerShell to get this error.  Use CMD, not PS.