ExifTool Forum

ExifTool => Newbies => Topic started by: JohnL404 on October 15, 2016, 02:48:10 PM

Title: Batch update only the date component of a tag and not its time
Post by: JohnL404 on October 15, 2016, 02:48:10 PM
I've spent hours today searching so I apologize if this has already been asked and answered elsewhere in the forums.

I'm trying to use ExifTool to batch update files with only the date component of a particular tag (ex: ModifyDate) but it's always requiring me to pass in time to the parameter.  For example, I want to set all files in the "2005-01-01" folder to 1/1/2005 but I do *not* want to touch their time stamps.  I've tried:

1. Using -ModifyDate="2005:1:1" but that didn't work.  It warns me the date/time stamp is incorrect.
2. Using -ModifyDate="2005:1:1 0" but that didn't work either.  It accepts the command but updates all of my date/time stamps to 1/1/2005 00:00:00.00-06:00".

Can someone please help?  Thanks in-advance!
Title: Re: Batch update only the date component of a tag and not its time
Post by: StarGeek on October 15, 2016, 03:29:41 PM
Yep, it's been answered before, but each situation is slightly different, so it can be hard to search on.

Basically, what you want to do is copy the tag into the same spot with changes.  So instead of the assignment = operation, you want to use tag redirection <.

Then you want to remove the date part of the tag.  In your case that would be ${ModifyDate;s/.* //}.  That will take everything in the ModifyDate tag up to and including the first space and remove it, leaving only the time part.

So your command would looks something like:
exiftool "-ModifyDate<2005:1:1 ${ModifyDate;s/.* //}" TargetFile
Title: Re: Batch update only the date component of a tag and not its time
Post by: JohnL404 on October 15, 2016, 04:21:48 PM
That worked perfectly -- thank you so much for the help, StarGeek!  :)