ExifTool Forum

ExifTool => Newbies => Topic started by: Andy on July 04, 2013, 03:06:49 PM

Title: Incorrectly created date
Post by: Andy on July 04, 2013, 03:06:49 PM
Hi

I have a lage bunt of images. Some of the images have corrupt created date. Locks that some software have stored date an time two times.

It looks like this:
{code}
Date Created                    : 00-07-31 15.19 00-07-31 15.19
{/code}

Have some one a tips how to fix this?

Best regards

// Andy

Title: Re: Incorrectly created date
Post by: StarGeek on July 04, 2013, 03:48:33 PM
I'm pushing my ExifTool boundaries here, but try this on a few copies of your problem files:

ExifTool "-DateCreated<${DateCreated;s/([0-9]{2}-[0-9]{2}-[0-9]{2} [0-9]{2}\.[0-9]{2}).*/$1/}" <file>

Hopefully Phil will be along with a refinement or better solution.
Title: Re: Incorrectly created date
Post by: Phil Harvey on July 05, 2013, 07:26:27 AM
Very odd.  If all of the dates are corrupted in the same way then StarGeek's idea should work.  You can also fill in the IPTC TimeCreated if you want:

exiftool "-datecreated<${datecreated;my @a=/\d+/g; $_=qq(20$a[0]:$a[1]:$a[2])}" "-timecreated<${datecreated;my @a=/\d+/g; $_=qq($a[3]:$a[4]:00-04:00)}" DIR

Here I have done things a bit differently than StarGeek, and am assuming that the dates are all after 2000.  For the TimeCreated I have added ":00" for seconds and a time zone of "-04:00".

The way I have done this, the command should only be run on files where the CreateDate is formatted like "YY-MM-DD hh.mm".  If you run it on other files you may get strange results.  StarGeek's pattern matching is better in this respect.

- Phil