Can ExifTool write just the time without date?

Started by kbellis, January 18, 2014, 01:50:24 PM

Previous topic - Next topic

kbellis

Howdy,

Is it possible for ExifTool to write just the time without including the date?

For example, instead of writing:
2013:01:25 08:06:04

only the time would be written out to the out.txt
08:06:04

And then on a related matter, could ExifTool write out just the date into its own field without the time?

Thanks!

Kelly

Phil Harvey

Hi Kelly,

There are different ways to do this depending on exactly what you want to do, but the technique that works in all cases is to use a config file to create user-defined Composite tags to isolate the date and time.  The conversions could look like this:

ValueConv => '$val =~ s/ .*//; $val',   # return the date from a date/time string

and

ValueConv => '$val =~ s/.* //; $val',   # return the time from a date/time string

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

kbellis

Phil - Thank you for the quick reply.

While I've solved this through formulas in the OpenOffice Calc spreadsheet, I'm still very interested in learning how to do this straight up in ExifTool.

Is this then how the .ExifTool_config file should look:

<snip>
#               For detailed information on the definition of tag tables and
#               tag information hashes, see lib/Image/ExifTool/README.
#------------------------------------------------------------------------------
# Saturday, January 18, 2014, 3:47 PM, VKB
# breakup date and time

ValueConvDate => '$val =~ s/ .*//; $val',   # return the date from a date/time string

ValueConvTime => '$val =~ s/.* //; $val',   # return the time from a date/time string


# Shortcut tags are used when extracting information to simplify
# commonly used commands.  They can be used to represent groups

<snip>

And then (wild stab) implementation in the .bat...

echo "FileName<tab>Date<tab>Time<tab>ShutterSpeed<tab>Aperture<tab>ISO" > %1\out.txt
C:\ExifTool\exiftool -T -r -n -filename -dateTimeOriginal -ValueConvDate  -dateTimeOriginal -ValueConvTime   -shutterspeedvalue -aperturevalue -ISO %1 >> %1\out.txt


...well, that didn't work - probably for multiple reasons ;)

File Placement
C:\ExifTool\filename_date_time_exposuretime_aperture_iso.bat
C:\ExifTool\exiftool.exe
C:\ExifTool\.ExifTool_config

...and (wild stab) variants aren't working either.

Thanks for any more pointers.

Kelly





Phil Harvey

Hi Kelly,

Take a look at the Composite tag definitions in the sample config file I linked from my last post.  Your config file should contain definitions like these.  Search for "UserDefined" and "Composite" in this forum for lots more examples.

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

kbellis

Hi Phil,

I think I'm getting closer, but still no cigar.

In the batch file I've tried both ways of not including / including the explicit call to the Exif_config; i.e.,:
echo "BaseName<tab>Date<tab>Time<tab>ShutterSpeed<tab>Aperture<tab>ISO" > %1\out.txt
C:\ExifTool\exiftool -config ExifTool_config -T -r -n -basename -date -time -shutterspeedvalue -aperturevalue -ISO %1 >> %1\out.txt


and in the .ExifTool_config I've made these insertions:
  # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique:  The Require/Desire elements specify
        # tags that must/may exist, and the keys of these hashes are used as
        # indices in the @val array of the ValueConv expression to access
        # the numerical (-n) values of these tags.  All Require'd tags must
        # exist for the Composite tag to be evaluated.  If no Require'd tags
        # are specified, then at least one of the Desire'd tags must exist.
        # See the Composite table in Image::ExifTool::Exif for more
        # examples, and lib/Image/ExifTool/README for all of the details.
        # --------------------------------------------------------------
        # With many thanks to Phil Havey
        # Sunday, January 19, 2014, 10:10 AM, VKB
# breakup date and time
# see thread: https://exiftool.org/forum/index.php/topic,5560.0.html
#
        # return the date from a date/time string
        Date => {
    Require => {
                0 => 'DateTimeOriginal',
    ValueConv => '$val =~ s/ .*//; $val',
        },
        # return the time from a date/time string
Time => {
    Require => {
                0 => 'DateTimeOriginal',
    ValueConv => '$val =~ s/.* //; $val',
        },
        #       
        # It's all Phil from here
        BaseName => {
            Require => {


Dragging and dropping a folder onto the bat produces null values at the three composite tag slots including BaseName, one already in the example config file:
"BaseName<tab>Date<tab>Time<tab>ShutterSpeed<tab>Aperture<tab>ISO"
- - - 0.0249999681652841 6.29999084227844 800
- - - 0.0249999681652841 6.29999084227844 800
- - - 0.00999997453917498 6.29999084227844 1600
- - - 0.0666666540332989 10.0000127304368 100
- - - 0.0399998981566999 8 100
- - - 0.00799996944425685 8 400
- - - 0.00124999681739687 5.60000399547274 1600


As stated earlier, the config file is in the same directory as the executable. And I'm using TextPad for editing, ANSI code set.

What might I try next?


kbellis

Phil - after I uploaded the attachment which included the config file, I removed the last line, the remnant from the bottom of this page:
https://exiftool.org/config.html

Phil Harvey

Hi Kelly,

Very close, but with your config file you should have got an error message like this:

syntax error at .ExifTool_config line 249, near ")"

If you didn't get this error, then maybe your config file wasn't in the proper directory.  Try loading it with the -config option (must be first on the command line).

The syntax problem is that the braces in your config file are not balanced.  You have left out the closing brace for each of the "Require" definitions.  It should look like this:

        Date => {
    Require => {
                0 => 'DateTimeOriginal',
            },
    ValueConv => '$val =~ s/ .*//; $val',
        },
        # return the time from a date/time string
Time => {
    Require => {
                0 => 'DateTimeOriginal',
            },
    ValueConv => '$val =~ s/.* //; $val',
        },


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

kbellis

Thanks for the pointers - braces balanced now... but still no luck.

As I mentioned earlier, I've included the explicit call call as shown in the .bat (above) and it didn't work. FWIW, the syntax error message never appeared either.

Beneath C:\ExifTool

kbellis

Phil,

In experiments this morning I tried something new. First using a larger set of test images: 1.44 GB, 120 images (instead of (7)). And then saving .ExifTool_config in a different format; i.e., starting with the file format for the PC encoded ANSI; UNIX encoded UTF-8; PC encoded UTF-8; back to PC encoded ANSI none of which had any different results but all of which allowed the little DOS window to linger visible long enough to read (and capture) and all which reported that the config file was not found.


Of course this still makes no sense since it has always been in the same directory since the getgo but it is at least another clue to go on.

kbellis

Phil,

In other experiments I've named .ExifTool_config using TextPad's Save As option and via the command line route - neither of which had any effect.

Kelly

kbellis

Here's another possible clue and a little background behind it.

I love TextPad and all of the amazing stuff it does including easy syntax highlighting and to do so I created a document class called Perl and am using TextPad's default color scheme for Perl.

I had previously associated the file type .ExifTool_config with the TextPad application overtly through both TextPad and Windows. Then in Windows Explorer double clicking .ExifTool_config would immediately open up TextPad, but the strange part was each time having to overtly turn syntax highlighting on... until I tried renaming .ExifTool_config to m.ExifTool_config - an arbitrary prefix. Then when double clicking on the file, TextPad colors the text - an interesting effect.. and maybe another clue?

FWIW - my machine: Win 7 64-bit

Phil Harvey

If your exiftool command has -config ExifTool_config, then there must be a file named "ExifTool_config" in the current working directory.  Does it show up when you type "dir ExifTool_config"?  If not, you must specify the proper path.

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

kbellis


Yes.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\ExifTool>dir
Volume in drive C has no label.
Volume Serial Number is BA85-76D5

Directory of C:\ExifTool

01/20/2014  07:36 AM    <DIR>          .
01/20/2014  07:36 AM    <DIR>          ..
01/20/2014  06:03 AM            14,064 .ExifTool_config
01/19/2014  07:12 PM               219 basename_date_time_exposuretime_aperture_iso.bat
01/20/2014  07:37 AM             1,392 Command Prompt.lnk
01/19/2014  11:44 AM             5,006 CompositeQuandary.zip
01/11/2014  06:44 AM         5,158,505 exiftool -k.exe
01/12/2014  10:31 AM         3,738,157 exiftool-9.46.zip
01/11/2014  06:44 AM         5,158,505 exiftool.exe
01/08/2013  08:04 PM         2,936,832 ExifToolGUI.exe
01/12/2014  12:01 PM               830 ExifToolGUI.ini
12/30/2009  02:29 PM             3,636 ExifToolGUI.txt
01/12/2014  10:42 AM           736,806 exiftoolgui.zip
01/12/2014  12:06 PM         1,390,188 exiftoolgui515.zip
01/19/2014  10:36 AM             1,442 ExifToolGUIv5.ini
04/30/2012  08:43 PM             2,399 ExifToolGUI_readme.txt
01/18/2014  11:19 AM               121 filename_aperture_iso.bat
01/19/2014  02:11 PM               196 filename_datetime_exposuretime_aperture_iso.bat
01/19/2014  11:25 AM               219 filename_date_time_exposuretime_aperture_iso.bat
01/18/2014  01:06 PM               192 filename_exposuretime_aperture_iso.bat
01/19/2014  09:02 AM    <DIR>          Image-ExifTool-9.46
01/18/2014  12:45 PM         3,725,846 Image-ExifTool-9.46.tar.gz
01/20/2014  06:08 AM    <DIR>          images
10/12/2009  11:59 AM    <DIR>          jhead_jpegtran
01/12/2014  12:07 PM    <DIR>          workspace
01/12/2014  05:26 PM        10,265,468 _5D34740.CR2
01/12/2014  05:26 PM        10,265,468 _5D34740.CR2_original
              21 File(s)     43,405,491 bytes
               6 Dir(s)  1,059,002,482,688 bytes free

C:\ExifTool>

Phil Harvey

The file is named ".ExifTool_config", but in your screen dump you typed "ExifTool_config" (no dot).  You need to type the exact name.

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

kbellis


Phil Harvey

Yes, but it isn't in the command you typed here:



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

kbellis

Okay - yes, you're correct - I've tried it both ways; however, with or without the dot the problem has been seen:

Phil Harvey

Now that's a bummer.

I did a search in the forum for "Config file not found", and it was only ever a problem with the path specification.

Are you sure that ExifTool has read permissions for the config file on your system?  I can't see why it shouldn't.

Try entering this command:

type CONFIGFILENAME

where CONFIGFILENAME is the name of your config file.

If that works, then I can imagine no reason why this would give a "Config file not found" error:

exiftool -config CONFIGFILENAME -date -time test.jpg

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

kbellis

Bummer or MYSTERY

Permissions:


Well... that at least the type command worked :)
#               the following environment variables:
#
#                   1. EXIFTOOL_HOME
#                   2. HOME
#                   3. HOMEDRIVE + HOMEPATH
#                   4. (the current directory)
#
#               Alternatively, the -config option of the exiftool application
#               may be used to load a specific configuration file (note that
#               it must be the first option on the command line):
#
#                   exiftool -config ExifTool_config ...
#
#               This sample file defines the following 16 new tags as well as a
#               number of Shortcut and Composite tags:
#
#                   1.  EXIF:NewEXIFTag
#                   2.  GPS:GPSPitch
#                   3.  GPS:GPSRoll
#                   4.  IPTC:NewIPTCTag
#                   5.  XMP-xmp:NewXMPxmpTag
#                   6.  XMP-exif:GPSPitch
#                   7.  XMP-exif:GPSRoll
#                   8.  XMP-xxx:NewXMPxxxTag1
#                   9.  XMP-xxx:NewXMPxxxTag2
#                  10.  XMP-xxx:NewXMPxxxTag3
#                  11.  XMP-xxx:NewXMPxxxStruct
#                  12.  PNG:NewPngTag1
#                  13.  PNG:NewPngTag2
#                  14.  PNG:NewPngTag3
#                  15.  MIE-Meta:NewMieTag1
#                  16.  MIE-Test:NewMieTag2
#
#               For detailed information on the definition of tag tables and
#               tag information hashes, see lib/Image/ExifTool/README.
#------------------------------------------------------------------------------

# Shortcut tags are used when extracting information to simplify
# commonly used commands.  They can be used to represent groups
# of tags, or to provide an alias for a tag name.
%Image::ExifTool::UserDefined::Shortcuts = (
    MyShortcut => ['exif:createdate','exposuretime','aperture'],
    MyAlias => 'FocalLengthIn35mmFormat',
);

# NOTE: All tag names used in the following tables are case sensitive.

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # All EXIF tags are added to the Main table, and WriteGroup is used to
    # specify where the tag is written (default is ExifIFD if not specified):
    'Image::ExifTool::Exif::Main' => {
        0xd000 => {
            Name => 'NewEXIFTag',
            Writable => 'int16u',
            WriteGroup => 'IFD0',
        },
        # add more user-defined EXIF tags here...
    },
    # the Geotag feature writes these additional GPS tags if available:
    'Image::ExifTool::GPS::Main' => {
        0xd000 => {
            Name => 'GPSPitch',
            Writable => 'rational64s',
        },
        0xd001 => {
            Name => 'GPSRoll',
            Writable => 'rational64s',
        },
    },
    # IPTC tags are added to a specific record type (ie. application record):
    # (Note: IPTC tag ID's are limited to the range 0-255)
    'Image::ExifTool::IPTC::ApplicationRecord' => {
        160 => {
            Name => 'NewIPTCTag',
            Format => 'string[0,16]',
        },
        # add more user-defined IPTC ApplicationRecord tags here...
    },
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::xmp' => {
        NewXMPxmpTag => { Groups => { 2 => 'Author' } },
        # add more user-defined XMP-xmp tags here...
    },
    # special Geotag tags for XMP-exif:
    'Image::ExifTool::XMP::exif' => {
        GPSPitch => { Writable => 'rational', Groups => { 2 => 'Location' } },
        GPSRoll  => { Writable => 'rational', Groups => { 2 => 'Location' } },
    },
    # new XMP namespaces (ie. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        xxx => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xxx',
                # (see the definition of this table below)
            },
        },
        # add more user-defined XMP namespaces here...
    },
    # new PNG tags are added to the PNG::TextualData table:
    'Image::ExifTool::PNG::TextualData' => {
        NewPngTag1 => { },
        NewPngTag2 => { },
        NewPngTag3 => { },
    },
    # add a new MIE tag (NewMieTag1) and group (MIE-Test) to MIE-Meta
    # (Note: MIE group names must NOT end with a number)
    'Image::ExifTool::MIE::Meta' => {
        NewMieTag1 => {
            Writable => 'rational64u',
            Units => [ 'cm', 'in' ],
        },
        Test => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MIETest',
                DirName => 'MIE-Test',
            },
        },
    },
    # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique:  The Require/Desire elements specify
        # tags that must/may exist, and the keys of these hashes are used as
        # indices in the @val array of the ValueConv expression to access
        # the numerical (-n) values of these tags.  All Require'd tags must
        # exist for the Composite tag to be evaluated.  If no Require'd tags
        # are specified, then at least one of the Desire'd tags must exist.
        # See the Composite table in Image::ExifTool::Exif for more examples,
        # and lib/Image/ExifTool/README for all of the details.
        BaseName => {
            Require => {
                0 => 'FileName',
            },
            # remove the extension from FileName
            ValueConv => '$val[0] =~ /(.*)\./ ? $1 : $val[0]',
        },
        # With many thanks to Phil Harvey
        # Sunday, January 19, 2014, 7:07 PM, VKB
        # breakup date and time
        # see thread: https://exiftool.org/forum/index.php/topic,5560.0.html
        #
        # return the date from a date/time string
        Date => {
                    Require => {
                        0 => 'DateTimeOriginal',
                    },
                    ValueConv => '$val =~ s/ .*//; $val',
                },
                # return the time from a date/time string
                Time => {
                    Require => {
                        0 => 'DateTimeOriginal',
                    },
                    ValueConv => '$val =~ s/.* //; $val',
        },
        #
        # It's all Phil from here
        # the next few examples demonstrate simplifications which may be
        # used if only one tag is Require'd or Desire'd:
        # 1) the Require lookup may be replaced with a simple tag name
        # 2) "$val" may be used to represent "$val[0]" in the expression
        FileExtension => {
            Require => 'FileName',
            ValueConv => '$val=~/\.([^.]*)$/; $1',
        },
        # override CircleOfConfusion tag to use D/1750 instead of D/1440
        CircleOfConfusion => {
            Require => 'ScaleFactor35efl',
            Groups => { 2 => 'Camera' },
            ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
            # an optional PrintConv may be used to format the value
            PrintConv => 'sprintf("%.3f mm",$val)',
        },
        # generate a description for this file type
        FileTypeDescription => {
            Require => 'FileType',
            ValueConv => 'GetFileType($val,1) || $val',
        },
        # calculate physical image size based on resolution
        PhysicalImageSize => {
            Require => {
                0 => 'ImageWidth',
                1 => 'ImageHeight',
                2 => 'XResolution',
                3 => 'YResolution',
                4 => 'ResolutionUnit',
            },
            ValueConv => '$val[0]/$val[2] . " " . $val[1]/$val[3]',
            # (the @prt array contains print-formatted values)
            PrintConv => 'sprintf("%.1fx%.1f $prt[4]", split(" ",$val))',
        },
        # [advanced] select largest JPEG preview image
        BigImage => {
            Desire => {
                0 => 'JpgFromRaw',
                1 => 'PreviewImage',
                2 => 'OtherImage',
                # (DNG and A100 ARW may be have 2 PreviewImage's)
                3 => 'PreviewImage (1)',
            },
            # ValueConv may also be a code reference
            # Inputs: 0) reference to list of values, 1) ExifTool object
            ValueConv => sub {
                my $val = shift;
                my ($image, $bigImage, $len, $bigLen);
                foreach $image (@$val) {
                    next unless ref $image eq 'SCALAR';
                    # check for JPEG image (or "Binary data" if -b not used)
                    next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/;
                    $len = $2 || length $$image; # get image length
                    # save largest image
                    next if defined $bigLen and $bigLen >= $len;
                    $bigLen = $len;
                    $bigImage = $image;
                }
                return $bigImage;
            },
        },
    },
);

# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'xxx', which corresponds to
# an ExifTool family 1 group name of 'XMP-xxx'.
%Image::ExifTool::UserDefined::xxx = (
    GROUPS        => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
    NAMESPACE     => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE      => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
    NewXMPxxxTag1 => { Writable => 'lang-alt' },
    NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
    NewXMPxxxTag3 => { List => 'Bag' },
    # example structured XMP tag
    NewXMPxxxStruct => {
        # the "Struct" entry defines the structure fields
        Struct => {
            # optional namespace prefix and URI for structure fields
            # (required only if different than NAMESPACE above)
            NAMESPACE => { 'test' => 'http://x.y.z/test/' },
            # optional structure name (used for warning messages only)
            STRUCT_NAME => 'MyStruct',
            # optional rdf:type property for the structure
            TYPE => 'http://x.y.z/test/xystruct',
            # structure field definitions (very similar to tag definitions)
            X => { Writable => 'integer' },
            Y => { Writable => 'integer' },
            # a nested structure...
            Things => {
                List => 'Bag',
                Struct => {
                    NAMESPACE => { thing => 'http://x.y.z/thing/' },
                    What  => { },
                    Where => { },
                },
            },
        },
        List => 'Seq', # structures may also be elements of a list
    },
    # Each field in the structure has an automatically-generated
    # corresponding flattened tag with an ID that is the concatenation
    # of the original structure tag ID and the field name (after
    # capitalizing the first letter of the field name if necessary).
    # The Name and/or Description of these flattened tags may be changed
    # if desired, but all other tag properties are taken from the
    # structure field definition.  When this is done, the "Flat" flag
    # must also be set in the tag definition.  For example:
    NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 },
);

# Adding a new MIE group requires a few extra definitions
use Image::ExifTool::MIE;
%Image::ExifTool::UserDefined::MIETest = (
    %Image::ExifTool::MIE::tableDefaults,   # default MIE table entries
    GROUPS      => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' },
    WRITE_GROUP => 'MIE-Test',
    NewMieTag2  => { },     # new user-defined tag in MIE-Test group
);

# A special 'Lenses' list can be defined to give priority to specific lenses
# in the logic to determine a lens model for the Composite:LensID tag
@Image::ExifTool::UserDefined::Lenses = (
    'Sigma AF 10-20mm F4-5.6 EX DC',
    'Tokina AF193-2 19-35mm f/3.5-4.5',
);

# Specify default ExifTool option values
# (see the Options function documentation for available options)
%Image::ExifTool::UserDefined::Options = (
    CoordFormat => '%.6f',  # change default GPS coordinate format
    Duplicates => 1,        # make -a default for the exiftool app
    GeoMaxHDOP => 4,        # ignore GPS fixes with HDOP > 4
);

#------------------------------------------------------------------------------
1;  #end

C:\ExifTool>

Phil Harvey

... and I take it the "exiftool" command still gave the "Config file not found" error?

What version of exiftool are you using, btw?  (type "exiftool -ver")

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

kbellis


Phil Harvey

This is getting silly.

OK.  Try just parsing the config file with exiftool (no -config option):

exiftool CONFIGFILE

ExifTool should at least return some system information about the file.

If it can find the file like this, then it should be able to find it as part of the -config option.  If it can't then there is something deeper going on.

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

kbellis

Good test - another clue .. though I'm not exactly sure what to make of it:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\ExifTool>exiftool .ExifTool_config
ExifTool Version Number         : 9.46
File Name                       : .ExifTool_config
Directory                       : .
File Size                       : 14 kB
File Modification Date/Time     : 2014:01:20 16:50:54-05:00
File Access Date/Time           : 2014:01:20 16:50:54-05:00
File Creation Date/Time         : 2014:01:20 16:50:54-05:00
File Permissions                : rw-rw-rw-
Error                           : Unknown file type
Base Name                       :
File Extension                  : ExifTool_config

C:\ExifTool>

kbellis

Phil,

Is it permissible to use the -config argument for anything other than .ExifTool_config; say for example:
exiftool -config date_time_config

I woke up thinking about ExifTool deciding the what I've been using was "unknown" and wondering, what if I just start from scratch?

Along the same line of starting fresh, I tried this:
echo "BaseName<tab>ShutterSpeed<tab>Aperture<tab>ISO" > %1\out.txt
C:\ExifTool\exiftool -config C:\ExifTool\Image-ExifTool-946\config_files\.ExifTool_config -T -r -n -basename -dateTimeOriginal -shutterspeedvalue -aperturevalue -ISO %1 >> %1\out.txt


That's the original factory default version without any of my hacks.

Eureka! It worked!!!

Okay, so the next thing then using TextPad was to shoehorn in the hack:

# With many thanks to Phil Harvey
# Tuesday, January 21, 2014, 6:16 AM, VKB
# breakup date and time
# see thread: https://exiftool.org/forum/index.php/topic,5560.0.html
#
# return the date from a date/time string
Date => {
    Require => {
                0 => 'DateTimeOriginal',
            },
    ValueConv => '$val =~ s/ .*//; $val',
        },
        # return the time from a date/time string
Time => {
    Require => {
                0 => 'DateTimeOriginal',
            },
    ValueConv => '$val =~ s/.* //; $val',
},
#       
        # It's all Phil from here


But not alter the calls in the bat just to see if that hack fetched things up - it didn't; it also ran perfectly.

Now to try using the revised bat with the calls to the two hacked arguments:
echo "BaseName<tab>Date<tab>Time<tab>ShutterSpeed<tab>Aperture<tab>ISO" > %1\out.txt
C:\ExifTool\exiftool -config C:\ExifTool\Image-ExifTool-946\config_files\.ExifTool_config -T -r -n -basename -date -time -shutterspeedvalue -aperturevalue -ISO %1 >> %1\out.txt


Oh, and look at that; it works great!

As for what in the heck was going on... man, I have no clue and truth be told I don't care to get into the necropsy; however, an explicit path beyond the home directory of exiftool may help in pinning down the reason for the issue.

Bottom line, thanks for being here and for the marvelous support on top of making this totally awesome tool!

Now onto the next custom tags!
Day_to_x
EV_base
EV_ISO
EV_to_y


But I'll save that for another thread ;)


Kind regards,

Kelly



Phil Harvey

Hi Kelly,

I'm glad you got it working, although we really still don't know what the problem was.  I thought the problem was likely due to file permissions, but the exiftool output shows that you do have read permissions for the file.

Anyway, it works now.  Good 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 ($).

kbellis

QuoteAs for what in the heck was going on... man, I have no clue and truth be told I don't care...

I guess I lied  ::)

Still thinking about this, I tried another experiment with the working config copied to the home directory c:\ExifTool and then calling for it without thinking that I had to call for its complete path since it was in the same directory - Nope, didn't work. But adding the call for the full path - worked fine.

Go figyah.

And props to our youngest son for the suggestion on our way back to UMF yesterday  :)

Phil Harvey

Yes, you need to specify the path if the directory is different from the current working directory.  (The "pwd" command will print the current working directory.)

But this doesn't explain the problem because the path must also be specified for the "type" command we tried, unless you were running these commands from different working directories (which would sort of defeat the point of this test).

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

kbellis

pwd is not recognized

Yes.. it's still a mystery, just ain't gnawing away as much ;)

Phil Harvey

Hmmm.  I thought that "pwd" worked in Windows too, but I guess not.  Googling this, just typing "cd" with no arguments should 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 ($).

kbellis

Okay..

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\ExifTool>pwd
'pwd' is not recognized as an internal or external command,
operable program or batch file.

C:\ExifTool>exiftool pwd
File not found: pwd

C:\ExifTool>cd
C:\ExifTool

C:\ExifTool>

Phil Harvey

I just thought that printing the working directory might help you to orient yourself better, but it is printed in your command prompt anyway, so my suggestion wasn't very useful.

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

kbellis

All efforts are appreciated - thank you Phil !

Kelly

StarGeek

Just pointing out that in both the command line examples, the working directory was C:\Users\V. Kelly Bellis\Pictures> while the location of the config file was in C:\ExifTool.   The correct beginning of the command should have been C:\ExifTool\exiftool -config C:\ExifTool\.ExifTool_config
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

kbellis

Nice catch! I didn't even see it - and another mystery !! After messing around with this so much over the past three days I no longer trust my memory in how that might have happened - that is weird though.

My first guess was that I had launched the cmd prompt window from a shortcut that was on my desktop but that stills sounds screwy - I dunno  :-\

kbellis

Well that little mystery is solved.

When you drag a folder, say for example one from My Pictures, and drop it onto the .bat for processing in ExifTool, that's when that red herring gets displayed albeit very briefly while the processing is going on.