Set ModifyDate to Current Date-Time

Started by Archive, May 12, 2010, 08:54:24 AM

Previous topic - Next topic

Archive

[Originally posted by jgb60 on 2008-08-16 19:49:49-07]

I just found and started using the Windows Executable version of ExifTool and can already see that it is very powerful but I have a lot to learn. I am trying automate some things with batch files but I would like to know how I can set ModifyDate to the current date/time in a Windows batch file? I can increment the current value and set it to a constant but I have not found a way to get the current date/time.

Thanks,
Drew

Archive

[Originally posted by exiftool on 2008-08-17 14:14:25-07]

Try this:

Code:
exiftool "-modifydate<$now" FILE
- Phil

Archive

[Originally posted by jgb60 on 2008-08-17 23:04:12-07]

That looks great but when I tried:  
     exiftool "-ModifyDate=$now" img_2415.jpg .
It replied:
     Invalid date/time (use YYYY:MM:DD HH:MM:SS[.SS][+/-HH:MM|Z]) in IFD0:ModifyDate (PrintConvInv)

         0 image files updated

         1 image files unchanged

Did I do something wrong?

Archive

[Originally posted by jgb60 on 2008-08-18 00:25:32-07]

I apologize. I now see that it works if I do what you said. (use &lt instead of =) Thanks again.

Archive

[Originally posted by fjord on 2008-08-18 05:56:23-07]

Phil, I wonder if you could briefly explain why the $ references to tags works in the "&lt" assignment, but not in the "=" assignment. I am a new user that also spent many fruitless hours trying to get similar date tag updates to work, before I discovered that "=" and "&lt" behave very differently.

Archive

[Originally posted by exiftool on 2008-08-18 10:35:45-07]

It is simple:

"=" sets the value of a tag.

"<" copies the values of other tags.

Enhancements to the "<" syntax (see the
-TagsFromFile section of the exiftool application
documentation) allow a string containing tag names prefixed
by "$", which is what we are doing here.  Also, a special "now"
tag is provided (see the Extra Tags documentation) to
represent the current date/time.

- Phil

Archive

[Originally posted by exiftool on 2008-08-18 13:01:15-07]

One more note:

I just realized that you don't need the "$" syntax for this
simple case.  Just "-modifydate<now" will work just
the same.

- Phil

Archive

[Originally posted by fjord on 2008-08-18 18:49:50-07]

Regarding "=" vs. "&lt", the difference, as I understand it, is what is permitted in the "expression" on the right side. In addition to copying a tag, the "&lt" form allows a kind of string expression using filename variables (%f etc.) and tag names ($tag), but the "=" form only allows constant values on the right. Is that correct?

Is -TAG<=FMT equivalent to -TAG<FMT?  Or is "&lt=" only used in the form -TAG&lt=DATFILE to set a tag from the contents of a file?

Archive

[Originally posted by exiftool on 2008-08-19 18:48:26-07]

Close, but not quite.  "=" takes a literal string as you
mentioned.  "&lt" takes a tag name.  An extension
to "&lt" also allows a string containing expressions
like $TAG, which are expanded to the tag value.
%f etc are only expanded when a filename is expected.

 - Phil