ExifTool Forum

ExifTool => Newbies => Topic started by: ocelotgabs on May 13, 2019, 09:12:18 PM

Title: Time and date from CSV file
Post by: ocelotgabs on May 13, 2019, 09:12:18 PM
Hello,

I have several scanned images from camera traps which used film (no digital). So I don't have the correct metadata from time and dates in the images. I however have them in a csv file. I need to import these correct time and dates to the images. Can I do that using exiftool? If so how? Thanks in advance !!!
Title: Re: Time and date from CSV file
Post by: Phil Harvey on May 13, 2019, 09:16:36 PM
Yes.  FAQ 26 (https://exiftool.org/faq.html#Q26) provides some help with this.

- Phil
Title: Re: Time and date from CSV file
Post by: ocelotgabs on May 13, 2019, 09:17:37 PM
Thanks Phil. I tried that and for some reason it didn't work.
Title: Re: Time and date from CSV file
Post by: Phil Harvey on May 13, 2019, 09:18:23 PM
Some details would be useful.  Could you post the command you used and attach the CSV file?

- Phil
Title: Re: Time and date from CSV file
Post by: ocelotgabs on May 13, 2019, 11:16:50 PM
My images and csv file are in different folders.

My .csv file only has two columns: SourceFile and datetime

This is how one row of the SourceFile (A2) looks like:
Station 01\D0001\007_rev1_0_no data_x.jpg

The datetime column looks like this (B2):
2008:01:25 19:54:00
*I have some empty rows in datetime

This is what I write in cmd

exiftool -datetime -csv G:\TEST_camtrapR\TestCamtrapR\data\testt
ime2.csv C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_20
08

What am I doing wrong?


Title: Re: Time and date from CSV file
Post by: StarGeek on May 14, 2019, 12:49:15 AM
Is the full path to your example file this?
C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_20\Station 01\D0001\007_rev1_0_no data_x.jpg

At the very least, you're not telling exiftool to check subdirectories.  You're only checking files in C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_20.  Add the -r option (https://exiftool.org/exiftool_pod.html#r-.--recurse) to check subdirectories.

But this won't be enough.  The file path you have in the csv will only be relative to the current directory.  You need to either add the full path to the SourceFile column, or CD into "C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_20" before running the command.

Finally, are you sure the tag you want to write to is DateTime?  That will write to the XMP-tiff:DateTime tag.  If you want to write to the EXIF block DateTime tag, which is that last time the image has been modified, then exiftool calls that ModifyDate.  If you want to write to the time the image was taken, then that would be DateTimeOriginal.  Or you could use AllDates which would write to DateTimeOriginal, ModifyDate (aka DateTime), and CreateDate (aka DateTimeDigitized).
Title: Re: Time and date from CSV file
Post by: ocelotgabs on May 14, 2019, 03:04:08 PM
Thank you StarGeek!

Ok, so I modified the SourceFile for each row to include the full path:
C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_20\Station 01\D0001\007_rev1_0_no data_x.jpg

I renamed the second column (my csv only has two columns) as DateTimeOriginal

Then I opened cmd and typed this:

exiftool -DateTimeOriginal -csv -r "G:\TEST_camtrapR\TestCamtrapR\data\testtime2.csv" "C:\Users\Bella\Pictures\CameraTra
ps\Project_GTM-005_Carmelita-AFISAP_2008"

But when I check a picture that should have the original date modified it still has the old date (2018).

File Modification Date/Time     : 2019:05:14 13:35:57-05:00
File Access Date/Time           : 2019:05:14 13:35:57-05:00
File Creation Date/Time         : 2018:02:20 21:00:31-06:00

What am I doing wrong?
PS My csv has some date time cells blank because I don't want to modify all the pictures.
Title: Re: Time and date from CSV file
Post by: Phil Harvey on May 14, 2019, 03:39:01 PM
Quote from: ocelotgabs on May 14, 2019, 03:04:08 PM
exiftool -DateTimeOriginal -csv -r "G:\TEST_camtrapR\TestCamtrapR\data\testtime2.csv" "C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_2008"

Try this:

exiftool -DateTimeOriginal -r -csv="G:\TEST_camtrapR\TestCamtrapR\data\testtime2.csv" "C:\Users\Bella\Pictures\CameraTraps\Project_GTM-005_Carmelita-AFISAP_2008"

- Phil
Title: Re: Time and date from CSV file
Post by: ocelotgabs on May 22, 2019, 04:38:34 PM
I just wanted to say that it worked! You guys are geniuses! Thanks for all the help.