ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:12 AM

Title: Set FileModifyDate from filename
Post by: Archive on May 12, 2010, 08:54:12 AM
[Originally posted by eam on 2007-12-02 14:02:10-08]

Hi, I have a number of files that are named based on the date e.g. 20071202_141600.jpg
I am trying to set the FileModifyDate directly from the file using the command:

exiftool "-FileModifyDate<FileName" -d %Y%m%d_%H%M%S *.jpg

but I get an error:
Warning: Error converting value for File:FileModifyDate (ValueConvInv) - 20071202_141600.jpg
    0 image files updated
    1 image files unchanged

same thing if I try "exiftool "-FileModifyDate<FileName" -d %Y%m%d_%H%M%S.jpg *.jpg"

Finally I tried "exiftool "-FileModifyDate<%15f" -d %Y%m%d_%H%M%S *.jpg"
and although I don't get an error this time I get
0 image files updated
1 image files unchanged

Anyone offer any help?
Eamon
Title: Re: Set FileModifyDate from filename
Post by: Archive on May 12, 2010, 08:54:12 AM
[Originally posted by eam on 2007-12-02 14:09:28-08]

(edited formatting)
Hi, I have a number of files that are named based on the date e.g. 20071202_141600.jpg

I am trying to set the FileModifyDate directly from the file using the command:

Code:
exiftool "-FileModifyDate<FileName" -d %Y%m%d_%H%M%S *.jpg

but I get an error:

Code:
Warning: Error converting value for File:FileModifyDate (ValueConvInv) - 20071202_141600.jpg
    0 image files updated
    1 image files unchanged

same thing if I try
Code:
exiftool "-FileModifyDate<FileName" -d %Y%m%d_%H%M%S.jpg *.jpg

Finally I tried
Code:
exiftool "-FileModifyDate<%15f" -d %Y%m%d_%H%M%S *.jpg
and although I don't get an error this time I get
Code:
   0 image files updated
    1 image files unchanged

Anyone offer any help?

Eamon
Title: Re: Set FileModifyDate from filename
Post by: Archive on May 12, 2010, 08:54:12 AM
[Originally posted by exiftool on 2007-12-02 14:19:16-08]

Hi Eamon,

Thanks for pointing out this problem.  I hadn't implemented the same
conversions for the FileModifyDate as I had for other EXIF date/time
tags.  The result is that this tag is more strict about the date/time
formatting.  For EXIF tags, exiftool allows any separators (or none at
all) to be used.  I will fix this, and exiftool 7.04 (to be released within
a few days or so) will be able to do what you want.  Note that the
-d option doesn't currently apply when writing tags, so
this had no effect.

- Phil
Title: Re: Set FileModifyDate from filename
Post by: Archive on May 12, 2010, 08:54:12 AM
[Originally posted by exiftool on 2007-12-02 14:21:56-08]

If you are using the Perl version, you can edit ExifTool.pm to fix
this in your copy now.  Just change PrintConvInv line in the
FileModifyDate definition to:

Code:
       PrintConvInv => 'Image::ExifTool::Exif::ExifDateTime($val)',

- Phil
Title: Re: Set FileModifyDate from filename
Post by: Archive on May 12, 2010, 08:54:12 AM
[Originally posted by eam on 2007-12-02 14:39:58-08]

Thanks Phil.  I am using the exe version so will wait for the fix as it is not urgent.  Will give the perl version a go if I need it b4 7.04 is released.

Eamon