Migrate keywords to previous version of photo

Started by Nailgun, February 21, 2011, 01:04:41 PM

Previous topic - Next topic

Nailgun

Hello,
I have a strange problem that I'm wondering if EXIFtool can fix.
I have about 200 images with incorrect date stamps. Not sure how that happened, but it's irritating when looking at my photo collection organized chronologically.
I found some old backups of these files on a CD which have correct dates. The problem is the newer versions of the files have keywords added.
I'd like to find a way to copy the keywords from the newer files with the incorrect dates to the old files with the correct dates.
Before I spent hours reading the documentation on EXIFtool, I thought I would ask the community if this is possible?
Thanks,
Paul

Phil Harvey

Hi Paul,

This sounds particularly easy.  You could either copy the Keywords to the original file, or the date/times to the edited files.

My only problem is that I don't know exactly what you mean by "date stamps".  If you run exiftool -s on an image and tell me the equivalent exiftool tag names then we can begin talking specifics.  ExifTool has the ability to read/write metadata date stamps, as well as the filesystem modification date/time.  The only thing it can't do is read or write the filesystem creation date.

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

Nailgun

OK. Thanks for answering me.
Here's a exiftool -s of the file that shows a 2006 creation date in OSX finder:

ExifToolVersion                 : 8.49
FileName                        : Christmas tree.jpg
Directory                       : /Volumes/media/Pictures/2001/Christmas/New Years Eve in South Dakota
FileSize                        : 262 kB
FileModifyDate                  : 2006:02:01 23:01:08-08:00
FilePermissions                 : rw-rw-rw-
FileType                        : JPEG
MIMEType                        : image/jpeg
JFIFVersion                     : 1.01
ResolutionUnit                  : inches
XResolution                     : 72
YResolution                     : 72
CurrentIPTCDigest               : 565c130fb7c9d732cb74413ad2ea4f72
ApplicationRecordVersion        : 2
Keywords                        : christmas, falls, new, sandy, sioux, tree, years
XMPToolkit                      : XMP toolkit 2.9-9, framework 1.6
About                           : uuid:8b367385-36e2-4d9f-9a1b-b93daef5c9ec
DocumentID                      : pixvue.com:docid:pixvue:c867921d-bca8-4152-bc69-de133b7dcbe7
Subject                         : christmas, falls, new, sandy, sioux, tree, years
ImageWidth                      : 819
ImageHeight                     : 1377
EncodingProcess                 : Baseline DCT, Huffman coding
BitsPerSample                   : 8
ColorComponents                 : 3
YCbCrSubSampling                : YCbCr4:2:0 (2 2)
ImageSize                       : 819x1377

And here's the same file from a backup:
ExifToolVersion                 : 8.49
FileName                        : Christmas tree.jpg
Directory                       : /Volumes/030203_1959/2001/Christmas/New Years Eve in South Dakota
FileSize                        : 256 kB
FileModifyDate                  : 2002:01:12 18:13:12-08:00
FilePermissions                 : rwxr-xr-x
FileType                        : JPEG
MIMEType                        : image/jpeg
JFIFVersion                     : 1.01
ResolutionUnit                  : inches
XResolution                     : 72
YResolution                     : 72
ImageWidth                      : 819
ImageHeight                     : 1377
EncodingProcess                 : Baseline DCT, Huffman coding
BitsPerSample                   : 8
ColorComponents                 : 3
YCbCrSubSampling                : YCbCr4:2:0 (2 2)
ImageSize                       : 819x1377



Phil Harvey

OK.  So it is the filesystem modification date/time you want.  (The tag called FileModifyDate.)  A command like this will copy it from the backup for this one image:

exiftool -tagsfromfile "/Volumes/030203_1959/2001/Christmas/New Years Eve in South Dakota/%f.%e" -filemodifydate "/Volumes/media/Pictures/2001/Christmas/New Years Eve in South Dakota/Christmas tree.jpg"

Or if you want to do this to all images in the entire directory tree, paste the following two commands into a Terminal window:

cd /Volumes/media/Pictures

exiftool -tagsfromfile /Volumes/030203_1959/%d%f.%e -filemodifydate -r .

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

Nailgun

Wow. Thank you so much for your help. I'm going to give this a shot when I get home from work tonight.

Nailgun

OK tried that with the recursive method and I get a "no file specified" message. Also tried copying all of the files to my local hard drive and adjusting the paths so that everything points correctly and still "no file specified."

Phil Harvey

It sounds like you forgot the last "." argument in the command, which represents the current directory.

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

Nailgun

What a difference a period can make.
That worked just like you said it would. What a fabulous tool you've created.
So now I'm noticing something very strange about these files. They have very abbreviated metadata. As you can see above, the only file date tag they have is FileModifyDate. Many other files taken by the same camera have a full set of metadata which includes a creation date and a slew of other camera-specific parameters from lens type to aperture.
This leads me to believe that some editing program I used on them years ago screwed up the metadata.
I also noticed that, in finder, both the modify and the create date show the same value.
So that got me thinking that I should store the value in FileModifyDate as a CreateDate tag as per the MWG standards. So I ran the following command on one file to try it out: exiftool '-FileModifyDate>CreateDate' /path
This did create a new CreateDate tag and it accurately copied the data in FileModifyDate to the new tag just as I wanted.
But when I look at the file in Mac Finder, I now see that both the file modify date and creation date are now set to today. I attached a screenshot showing what I mean.
Any idea what's causing this to happen in finder? I wonder if this has something to do with file attributes versus metadata tags?
Thanks for your amazing help,
- Paul

Phil Harvey

Hi Paul,

Yes,  FileModifyDate is set to the current date/time when actually modifying the image unless you use the -P option to preserve it.

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