problem setting DateTimeOriginal>FileModifyDate

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

Previous topic - Next topic

Archive

[Originally posted by airdrummer on 2008-04-04 17:44:48-07]

i'm trying to set \"-DateTimeOriginal>FileModifyDate\" AND -d %%Y/%%m/%%d \"-directory<datetimeoriginal\" (awk escapes) both in the same invocation...

the problem is:

    Date/Time Original              : 2008:03:16 17:53:35

but after the execution the filedate is:

-rw------- 1 myuid mygid 3962576 Mar 16 00:00 2008/03/16/2008-03-16_17-53-35_01.jpg

d'oh! time got zeroed:-( or am i missing some esoteric switch?

Archive

[Originally posted by exiftool on 2008-04-04 17:53:52-07]

Unfortunately the -d option affects all dates.  The
only way around this is to create a simple user-defined tag
which is the unformatted datetimeoriginal.  You may be able
to find an example if you search the forum, but right at the
moment I have a meeting so this is the best I can do for now.

- Phil

Archive

[Originally posted by exiftool on 2008-04-05 10:58:44-07]

Well, I tried this search myself and couldn't find the thread
I was thinking about, so here is a .ExifTool_config file that will
allow you to do this:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyDateTime => {
            Require => 'DateTimeOriginal',
            ValueConv => '$val',
        },
    },
);
1;  #end

With this, you would use the following command:

Code:
exiftool -d %Y/%m/%d "-FileModifyDate<MyDateTime" "-directory<datetimeoriginal" FILE

See the https://exiftool.org/config.html" target="_blank">config
file documentation for a description of how to install the .ExifTool_config file.

- Phil

Archive

[Originally posted by airdrummer on 2008-04-07 10:46:11-07]



thanx 4 the info, phil, i'll give it a shot, but i'm curious as to why MyDateTime isn't also affected by the -d spec.

and is "-FileModifyDate<MyDateTime" preferred over "-MyDateTime>FileModifyDate" or just a matter of style?

Archive

[Originally posted by exiftool on 2008-04-07 11:24:22-07]

The -d is applied in the print conversion for all
date/time tags.  (Aside: When using the API, print
conversions can be disabled on a per-tag basis, so this would have
solved your problem, but with the command line I have only provided
a -n option which disables all print conversions,
so this doesn't help us.)  The print conversion must be specified
explicitly for each tag.  If we had wanted to apply the date
conversion for our MyDateTime tag, the definition would
have looked like this:

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyDateTime => {
            Require => 'DateTimeOriginal',
            ValueConv => '$val',
            PrintConv => '$self->ConvertDateTime($val)',
        },
    },
);
1;  #end

Note the extra PrintConv line.

- Phil

Archive

[Originally posted by exiftool on 2008-04-07 11:29:53-07]

And you can use whichever method takes your fancy ">" or "&lt"
both do the same thing for a simple copy.  The constraint is that
the left hand side must be a tag name, which limits the ">"
version a bit because you can't do things like this:

Code:
exiftool "-comment<this file was created on $createdate" FILE

But we aren't doing anything like this here.

- Phil

Archive

[Originally posted by airdrummer on 2008-04-07 11:49:27-07]



ah, that explains it, thanx:-) it would b nice if the conversion applied to subsequent fields (those following the format spec on the command line) but i imagine that would require major retooling...

great tool, thanx:-)