Main Menu

How to create EXIF data?

Started by BSlack, January 31, 2011, 02:38:04 PM

Previous topic - Next topic

BSlack

I have many old pictures that have no EXIF data.  Is there a simple way to add a generic header to file that don't have one, but leave the others as they are?

I am using 'better finder attributes' to copy the file creation date to the EXIF date, but it doesn't know what to do with files that have no original data.

Thanks,

Brian

Phil Harvey

Hi Brian,

I don't know what you want to write other the date, but the file modification date can be copied to Exif:DateTimeOriginal only if it doesn't exist with this command:

exiftool "-exif:datetimeoriginal<filemodifydate" -if "not $datetimeoriginal" DIR

Where DIR is the name of a directory containing the images.

(note: use single quotes instead of double if you are on Mac or Linux).

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

BSlack

Quote from: Phil Harvey on January 31, 2011, 02:44:07 PM
Hi Brian,

I don't know what you want to write other the date, but the file modification date can be copied to Exif:DateTimeOriginal only if it doesn't exist with this command:

exiftool "-exif:datetimeoriginal<filemodifydate" -if "not $datetimeoriginal" DIR

Where DIR is the name of a directory containing the images.

(note: use single quotes instead of double if you are on Mac or Linux).

- Phil

That worked great!   Thank you.

I had written a script that that takes the files path:

2004
    >02
       >13
           >example.jpg

and uses that for the modification and creation dates.  Now I can update the EXIF data at the same time.

How would I do this and not have it create a copy of the file?

Thanks again!

Brian

BSlack

Quote from: Phil Harvey on January 31, 2011, 02:44:07 PM
I don't know what you want to write other the date, but the file modification date can be copied to Exif:DateTimeOriginal only if it doesn't exist with this command:

OK . . . if I wanted to update files that do have EXIF data, how would I update the Original and Digitized date for the modification date?

Thanks,

Brian

BSlack

Quote from: Phil Harvey on January 31, 2011, 02:44:07 PM
exiftool "-exif:datetimeoriginal<filemodifydate" -if "not $datetimeoriginal" DIR

I figured it out.  This seems to work very nicely.  I just added a bit to my script to update the modification date after this is done.

exiftool -overwrite_original_in_place '-exif:datetimeoriginal<filemodifydate' DIR

Thanks,

Brian

Phil Harvey

Quote from: BSlack on January 31, 2011, 07:01:20 PM
I had written a script that that takes the files path:

2004
    >02
       >13
           >example.jpg

and uses that for the modification and creation dates.

You could have done this with exiftool too:

exiftool "-filemodifydate<$directory 00:00:00" -r .

QuoteHow would I do this and not have it create a copy of the file?

Seems you figured this one out. :)

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