Finding common metadata entry in two sets of photos

Started by krzysiu, April 19, 2020, 10:28:32 AM

Previous topic - Next topic

krzysiu

At first I have to admit I already did it with own script*, but I wish that it could be done in ExifTool alone.

The problem is having two sets of photos with different filenames and possibly slight changes in metadata (which makes comparing in by hash or filename useless) with possible common photos in both sets. As I'm using a single camera, the easiest way for me was to compare dates. For the sake of clarity let's assume we have two small sets and instead whole dates I'll just write HH:MM:

Set A:

  • P1.CR2 (15:30)
  • P2.CR2 (16:20)
  • P3.CR2 (17:20)
  • P4.CR2 (17:07)

Set B:

  • f532244.CR2 (16:20)
  • f424232.CR2 (17:07)
  • f765342.CR2 (17:15)

Is there some way for ExifTool to recognize that f532244 have same date as is P2 and P4 same as f424232?

I know there are other ways of comparing photos, like extract thumbnail from raw and compare it by hash, but that one really worked the best for me. And probably some of you already guessed by names of 2nd set it's about cleaning up recovered photos.

* https://pastebin.com/y3mFhui7 - in case somebody would need it. It's as simple as that. It takes two CSV outputs of Exiftool (exiftool -csv -DateTimeOriginal . > data.txt) and compares it.
"We would use teleporters and live on another planets, if only ExifTool would be present when I was researching cosmos and physics"
Albert Einstein

Phil Harvey

Yes, this is possible by creating a HardLink with a name based on the date/time.  (See the Extra tags documentation for some notes about the HardLink tag.)

But I don't know what you want to do once you associate the files, so I can't be more specific.

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

krzysiu

Thanks, Phil! I'd just want to see the names, without taking action (except manual). It's about recovered memory card (one set) and checking which files were already on the harddrive (other set).
"We would use teleporters and live on another planets, if only ExifTool would be present when I was researching cosmos and physics"
Albert Einstein

Phil Harvey

OK, for a start maybe the easiest thing to do is to make a list of file names sorted by date/time, like this:

exiftool -createdate -directory -filename DIR1 DIR2 | sort > out.txt

Then look for lines with the same date/time.  I use a utility called 'uniq' to search for identical entries in a file, but you may have your own utility to do 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 ($).

krzysiu

Great, thanks! :D I don't have such tool right now, but I enjoy programming, so I'll manage from now :)
"We would use teleporters and live on another planets, if only ExifTool would be present when I was researching cosmos and physics"
Albert Einstein

StarGeek

If you're on Windows, there is a sort command already, though you'll probably have to test/research it to see if it can do the same as the Linux/Mac sort command.

Another option would be exiftool's -FileOrder option.  It's not as quick as piping to sort, but it is built into exiftool.
exiftool -FileOrder CreateDate -createdate -directory -filename DIR1 DIR2 >out.txt
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype