Removing tags and renaming and the same time

Started by muddle, November 06, 2016, 08:56:34 AM

Previous topic - Next topic

muddle

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

Phil Harvey

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 for an explanation.)

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

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

muddle

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

Phil Harvey

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