Change DATE only in datetimeoriginal

Started by damage, January 02, 2014, 06:08:34 AM

Previous topic - Next topic

Phil Harvey

What you want to do is equivalent to this:

exiftool -m '-DateTimeOriginal<2014:04:05 ${DateTimeOriginal;s/.* //}' '-CreateDate<2014:04:05 ${CreateDate;s/.* //}' '-ModifyDate<2014:04:05 ${ModifyDate;s/.* //}' 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 ($).

orbspider

Ok, thanks Phil, so if that's the only way I'll use it, I just thought there might/could be an easier way of writing the command!

orbspider

Uh oh,
all the hr:min:sec time stamps got changed to the same- for 150 images (20:06:01.00) -might well be taken from the first image and written it to all of them??
that's not current time here.

Phil Harvey

More likely the times got messed up by an earlier incorrect command.  The command I gave should work.  (Note the quoting is for Mac/Linux)

> exiftool -alldates tmp
======== tmp/a.jpg
Date/Time Original              : 2003:10:31 15:44:19
Create Date                     : 2003:10:31 15:44:19
Modify Date                     : 2003:10:31 15:44:19
    1 directories scanned
    1 image files read

> exiftool -m '-DateTimeOriginal<2014:04:05 ${DateTimeOriginal;s/.* //}' '-CreateDate<2014:04:05 ${CreateDate;s/.* //}' '-ModifyDate<2014:04:05 ${ModifyDate;s/.* //}' tmp
    1 directories scanned
    1 image files updated

> exiftool -alldates tmp
======== tmp/a.jpg
Date/Time Original              : 2014:04:05 15:44:19
Create Date                     : 2014:04:05 15:44:19
Modify Date                     : 2014:04:05 15:44:19
    1 directories scanned
    1 image files read


You should be able to fix your problem with this command (assuming the "_original" files still exist):

exiftool -tagsfromfile %d%f.%e_original -m '-DateTimeOriginal<2014:04:05 ${DateTimeOriginal;s/.* //}' '-CreateDate<2014:04:05 ${CreateDate;s/.* //}' '-ModifyDate<2014:04:05 ${ModifyDate;s/.* //}' DIR

If you really want to set all of these date/time tags to a specific date while leaving the time the same, then I can't think of an easier way.

But if you just want to shift the date/time values by a constant amount, then you could use -alldates+="YEARS:MONTHS:DAYS 0" instead.

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

orbspider


dav>10:46:59:/media/FILES/my pictures/3$ exiftool -alldates test.jpg
Date/Time Original              : 2014:05:01 18:38:36
Create Date                     : 2014:05:01 18:38:36
Modify Date                     : 2014:05:01 18:38:36
dav>10:47:11:/media/FILES/my pictures/3$ exiftool -m '-DateTimeOriginal<2013:05:05 ${DateTimeOriginal;s/.* //}' '-CreateDate<2013:05:05 ${CreateDate;s/.* //}' '-ModifyDate<2013:05:05 ${ModifyDate;s/.* //}' *
Warning: Bad PreviewIFD directory - test.jpg
Warning: Deleted bad PreviewIFD directory - test.jpg
    1 image files updated
dav>10:47:41:/media/FILES/my pictures/3$ exiftool -alldates test.jpg
Date/Time Original              : 2013:05:05 20:14:05
Create Date                     : 2013:05:05 20:14:05
Modify Date                     : 2013:05:05 20:14:05



Obviously it's the old date Y:M:D going on as the new time, so anyhow, and with the shift method:

dav>10:59:03:/media/FILES/my pictures/3$ exiftool -alldates test2.jpg
Date/Time Original              : 2006:01:05 18:57:24
Create Date                     : 2006:01:05 18:57:24
Modify Date                     : 2006:01:05 18:57:24
dav>10:59:10:/media/FILES/my pictures/3$ exiftool -m -alldates+='8:2:1 0' test2.jpg
    1 image files updated
dav>10:59:38:/media/FILES/my pictures/3$ exiftool -alldates test2.jpg
Date/Time Original              : 2014:03:06 18:57:24
Create Date                     : 2014:03:06 18:57:24
Modify Date                     : 2014:03:06 18:57:24


much better results!

Phil Harvey

You must be using a very old version of ExifTool.  The advanced formatting feature was added in version 9.15 (over a year ago).  If you update your ExifTool, then the first technique will work.

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

orbspider

indeed it is, v 8.60-2 from Debian stable repo.