Time and date from CSV file

Started by ocelotgabs, May 13, 2019, 09:12:18 PM

Previous topic - Next topic

ocelotgabs

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 !!!

Phil Harvey

Yes.  FAQ 26 provides some help with this.

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

ocelotgabs

Thanks Phil. I tried that and for some reason it didn't work.

Phil Harvey

Some details would be useful.  Could you post the command you used and attach the CSV file?

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

ocelotgabs

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?



StarGeek

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 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).
* 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).

ocelotgabs

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.

Phil Harvey

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

ocelotgabs

I just wanted to say that it worked! You guys are geniuses! Thanks for all the help.