Writing the creation date of a batch of files into EXIF tags?

Started by khk, April 18, 2010, 03:35:52 PM

Previous topic - Next topic

khk

Many image files do not have EXIF tags, but their file system creation or modification date could be used to fix that. Can ExifTool use the file system creation or modification date as input for setting the EXIF tags (e.g. with AllDates) to a batch of files?

If this can be done, how to write a script that does this but skips files that already do have their EXIF dates set?

-kh

Phil Harvey

ExifTool can use the filesystem modification date/time, but not the creation date/time.  Here is how this would be done:

exiftool "-modifydate<filemodifydate" -if "not $modifydate" DIR

(but use single quotes instead of double quotes around arguments containing $ if you are on a Mac or Linux system.)

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

dmtoddma

This presents a problem for dating scanned photos. I have photos in which the file creation date does reflect the date the photo was scanned, but the file modified date has been changed since the file was created, and DateCreated, if it exists, may also not be the original file creation date. I can probably find a way to reset the file modification date to the file date created, but I have a lot of photos and I'm trying to make it as efficient as possible. Any chance of adding file creation date as a "source" for ExifTool?

Thanks.

David

Phil Harvey

Hi David,

Sorry for the delay in responding.  I was on vacation.

I have looked into this.  I think it is possible by including 3rd-party platform-specific libraries with ExifTool.  However, so far I have managed to keep ExifTool's dependencies to a minimum, so although this route isn't very appealing I may have to bite the bullet and do this anyway.

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

MOL

Phil,

I don't know if using third-party code is really a good idea. We all know that you open a can of worms with this, including but not limited to a maintenance nightmare in the future. It should only be done if advantages far outweigh the disadvantages, IMHO.

Uwe