ExifTool Forum

ExifTool => Newbies => Topic started by: jcharmon on June 19, 2013, 03:11:07 PM

Title: Set dates from file name
Post by: jcharmon on June 19, 2013, 03:11:07 PM
According to ExifTool FAQ #5, I should be able to set metadata dates from the file name, but I'm having trouble getting it work. The -alldates option seems to function as intended:
"For example, the command
exiftool "-alldates<filename" c:\images
will set the common date/time tags from the file name for all images in the directory "c:\images". This will work for any file name which matches the above criteria (ie. "IMG_20110927_103000.jpg")."
I can get this to work with my files when they have the appropriate file names as described in the FAQ.

But my efforts to set other dates aren't working, not even using a different example given in the FAQ:
exiftool -xmp:dateTimeOriginal="2005:10:23 20:06:34.33-05:00" a.jpg

I've even renamed my target file a.jpg to match the example. Using the -v flag, I get the following output but the intended date doesn't show up anywhere in the metadata.

C:\Temp\Dates>exiftool -v -xmp:dateTimeOriginal="2005:10:23 20:06:34.33-05:00" a.jpg
======== a.jpg
Rewriting a.jpg...
  Editing tags in: APP1 XMP
JPEG APP0 (14 bytes):
JPEG APP1 (238 bytes):
JPEG APP13 (190 bytes):
JPEG APP1 (4478 bytes):
  Rewriting XMP
JPEG DQT (65 bytes):
JPEG SOF0:
JPEG DHT (29 bytes):
JPEG DHT (179 bytes):
JPEG SOS
    1 image files updated


Am I missing something?
Title: Re: Set dates from file name
Post by: Phil Harvey on June 19, 2013, 07:15:02 PM
I'm glad to see that you have read the FAQ, which makes me feel guilty because I think the answer to your problem lies in FAQ number 3 (https://exiftool.org/faq.html#Q3).  ie) I think that the tag is getting written, but that you just don't realize it.   Also, try -v2 instead of just -v when writing to see the pertinent details.

- Phil
Title: Re: Set dates from file name
Post by: jcharmon on June 19, 2013, 08:31:38 PM
Attached is sample input and output from an ExifTool set date command, per the FAQ (I copied the command directly from the FAQ). That example in the FAQ didn't include explicit formatting information, so I assumed it wasn't needed. The test file is a new file with no included image, but with original and digitized dates added as part of a previous test.

As you can see, ExifTool says it wrote the date to the file, but a listing of metadata contents doesn't show the new date. I also tried including the -m flag in case that would make a difference; it doesn't.

Title: Re: Set dates from file name
Post by: Phil Harvey on June 20, 2013, 07:24:52 AM
You can see that the information is written in the -v2 output, but you don't see it when you read back the information because it is a duplicate tag.  You need to include the -a option when reading back, as per FAQ 3.

- Phil
Title: Re: Set dates from file name
Post by: jcharmon on June 21, 2013, 09:09:30 PM
Thanks. After further close reading of the FAQ and additional testing, I got it all worked out.