ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: muddle on November 06, 2016, 08:56:34 AM

Title: Removing tags and renaming and the same time
Post by: muddle on November 06, 2016, 08:56:34 AM
First, thanks for creating ExifTool! I am taking my first steps and stumbled across an oddity in the current Windows version (10.31) that I cannot explain.

I am trying to remove most EXIF information, keeping only DateTimeOriginal, ImageDescription and Comment while renaming the file at the same time:

exiftool.exe -all= -tagsFromFile @ -ImageDescription -DateTimeOriginal -comment "-filename<DateTimeOriginal" -d %Y/%m/test_%Y-%m-%d_%H%M%S.jpg test.jpg
    1 directories created
    1 image files created


DateTimeOriginal of the original file, before running the above command:
exiftool.exe -DateTimeOriginal test.jpg
Date/Time Original              : 2011:04:22 10:24:41

DateTimeOriginal after:
exiftool.exe -DateTimeOriginal 2011\04\test_2011-04-22_102441.jpg
Date/Time Original              : 2011:04:20 11:04:22

Note the different dates. :o Also, the original file test.jpg is still in place at its original location, while the renamed file is located at the desired location.

Running two separate commands (first cleaning up, then renaming) works as expected: EXIF data is being cleaned up and the file is moved to the new location with DateTimeOriginal staying intact.

Is there something I am doing wrong?

Thanks!

--
Best regards,
muddle
Title: Re: Removing tags and renaming and the same time
Post by: Phil Harvey on November 06, 2016, 09:16:39 AM
When you write any metadata exiftool automatically keeps a backup "_original" file for you.  But if you also rename the file at the same time, then file with the original name is your backup.  If you don't want the original preserved then add -overwrite_original to the command.  (See the Notes here (https://exiftool.org/filename.html) for an explanation.)

About the DateTimeOriginal problem:  Try this command on the original file: exiftool -a -G1 -datetimeoriginal FILE

- Phil
Title: Re: Removing tags and renaming and the same time
Post by: muddle on November 06, 2016, 09:39:01 AM
Hi Phil,

thanks for the quick response and the explanation for the "leftover" original file.

Quote
Quote from: Phil Harvey on November 06, 2016, 09:16:39 AM
Try this command on the original file: exiftool -a -G1 -datetimeoriginal FILE

Here is the output:
[ExifIFD]       Date/Time Original              : 2011:04:22 10:24:41

--
Best regards,
muddle
Title: Re: Removing tags and renaming and the same time
Post by: Phil Harvey on November 06, 2016, 02:08:39 PM
Ah, right. I see the problem (I thought maybe it was due to another DateTimeOriginal tag in your file, but that wasn't the case).  Your -d option has messed up the format for copying the date.  Try this:

exiftool.exe -all= -tagsFromFile @ -ImageDescription -DateTimeOriginal# -comment "-filename<DateTimeOriginal" -d %Y/%m/test_%Y-%m-%d_%H%M%S.jpg test.jpg

Adding the "#" after DateTimeOriginal disables the date/time formatting when copying this tag.

- Phil