ExifTool Forum

ExifTool => Newbies => Topic started by: DmitTrix on March 21, 2022, 07:38:43 AM

Title: Copying tags from one file to another with modifications
Post by: DmitTrix on March 21, 2022, 07:38:43 AM
I'm trying to copy date/time information from one file to another, and increment the time by 1 second. I can do it successfully by running two commands in a row:
exiftool  -tagsFromFile  path/to/source.jpg   -DateTimeOriginal           -ModifyDate           -CreateDate          -overwrite_original  path/to/destination.jpg
exiftool                                     '-DateTimeOriginal+=0:0:1'  '-ModifyDate+=0:0:1'  '-CreateDate+=0:0:1'  -overwrite_original  path/to/destination.jpg


Is there a way to achieve the same with a single command? I try this:
exiftool  -tagsFromFile  path/to/source.jpg  '-DateTimeOriginal+=0:0:1'  '-ModifyDate+=0:0:1'  '-CreateDate+=0:0:1'  -overwrite_original  path/to/destination.jpg
I get no errors/warnings from exiftool, but the destination file lacks the above 3 tags altogether.

I'm running exiftool 12.30 on macOS 12.3

Thanks!
Title: Re: Copying tags from one file to another with modifications
Post by: StarGeek on March 21, 2022, 11:10:12 AM
If you're copying from one file directly onto another, you can use the GlobalTimeShift option (https://exiftool.org//exiftool_pod.html#globalTimeShift-SHIFT).
C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test3.jpg
[ExifIFD]       DateTimeOriginal                : 2022:03:21 12:00:00

C:\>exiftool -P -overwrite_original -GlobalTimeShift 0:0:1 -TagsFromFile y:\!temp\Test3.jpg -DateTimeOriginal y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2022:03:21 12:00:01


But if you plan on doing it in batch, you'll have to use two commands.  See here (https://exiftool.org/forum/index.php?topic=5621.0).
Title: Re: Copying tags from one file to another with modifications
Post by: DmitTrix on March 22, 2022, 06:07:18 AM
Thanks a lot, -GlobalTimeShift does the trick for my use case (working with individual files).