[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
[Originally posted by exiftool on 2008-08-17 14:14:25-07]Try this:
exiftool "-modifydate<$now" FILE
- Phil
[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?
[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 < instead of =) Thanks again.
[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 "<" 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 "<" behave very differently.
[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
[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
[Originally posted by fjord on 2008-08-18 18:49:50-07]
Regarding "=" vs. "<", the difference, as I understand it, is what is permitted in the "expression" on the right side. In addition to copying a tag, the "<" 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 "<=" only used in the form -TAG<=DATFILE to set a tag from the contents of a file?
[Originally posted by exiftool on 2008-08-19 18:48:26-07]
Close, but not quite. "=" takes a literal string as you
mentioned. "<" takes a tag name. An extension
to "<" 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