ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: krzysiu on April 19, 2020, 10:28:32 AM

Title: Finding common metadata entry in two sets of photos
Post by: krzysiu on April 19, 2020, 10:28:32 AM
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:

Set B:

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.
Title: Re: Finding common metadata entry in two sets of photos
Post by: Phil Harvey on April 19, 2020, 11:23:53 AM
Yes, this is possible by creating a HardLink with a name based on the date/time.  (See the Extra tags documentation (https://exiftool.org/TagNames/Extra.html) 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
Title: Re: Finding common metadata entry in two sets of photos
Post by: krzysiu on April 20, 2020, 08:44:26 AM
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).
Title: Re: Finding common metadata entry in two sets of photos
Post by: Phil Harvey on April 20, 2020, 12:47:39 PM
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
Title: Re: Finding common metadata entry in two sets of photos
Post by: krzysiu on May 01, 2020, 04:09:55 PM
Great, thanks! :D I don't have such tool right now, but I enjoy programming, so I'll manage from now :)
Title: Re: Finding common metadata entry in two sets of photos
Post by: StarGeek on May 01, 2020, 04:16:06 PM
If you're on Windows, there is a sort (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/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 (https://exiftool.org/exiftool_pod.html#fileOrder-NUM---TAG).  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