Compare two folders contents by filename

Hi, felows!


Is there any convenient way to compare two folders contents by filename?


(I miss DOS Navigator so bad...)

iMac 27″ 5K, macOS 12.1

Posted on Jan 28, 2022 7:52 AM

Reply
13 replies

Jan 28, 2022 10:27 AM in response to Alejandro_64

Alejandro_64 wrote:

(Makes me mad that in FAR Manager in Windows this is done in 2 minutes with "File Compare" dialog. Yet, in macOS I already spent 2 days to find solution and didnt find yet.)

Is it that bad? 2 days, eh?


Well, I have never heard for FAR Manager, so I googled it. It isn't part of Windows. It is a 3rd party app. And there is a Mac version. So what exactly where you looking for?


Of course you know, when you say something that, it is a rule that one has to take the subject of your question and put it into a Google search. The top, and repeated hit, was my own suggestion to use "diff". Some other great suggestions are Beyond Compare (another Windows app that also has a Mac version, Diffmerge (ditto), Kaleidoscope (a Mac-only app).

Jan 28, 2022 1:34 PM in response to Alejandro_64

Does one folder exclusively contain {jpg, jpeg} images and the other folder contain just {heic} images? Flat folders, or a folder hierarchy of sub-folders in each main folder?


I have a working Ruby script that when supplied with the two folders, compares image basenames between the two folders (no hierarchy) and writes a report of those matching file basenames to the Desktop. On completion, it presents an AppleScript dialog that tells how many files matched and the elapsed processing time.


Is this something you are interested in?

Jan 28, 2022 9:51 PM in response to etresoft

3 days now.


Would you be so kind to provide direct link to FAR manager for macOS? Don't see it.


To be more specific: Connection of iCloud+ duplicated most of my JPEG photos in iMac Photo Library (acquired via Photo Stream - that's why they are in JPEG) with their original, HEIC, originals on iPhone. Merged 2 libraries in one.


Primary problem is: Get rig of JPEG duplicates of HEIC photos. Duplicates have identical filenames but different extensions. Photos doesn't provide means to compare two smart folders - so I have to do it in externally in file folders, as files, and import them back after that.


Secondary problem: How to delete exessive JPEGs from photo library?

Jan 28, 2022 9:54 PM in response to VikingOSX

"Does one folder exclusively contain {jpg, jpeg} images and the other folder contain just {heic} images? "


Yes, that's correct. And folders are flat, no hierarghy. One contains JPEG's and another HEIC. Duplicates have identical file names.


So, main problem is:

How to delete JPEG duplicates matching by name HEIC photos AND not to delete JPEGs that don't have HEIC sibling.



If you script can help with that it's most welcome. I wonder what to do after I get the list though...

Jan 29, 2022 5:19 AM in response to Alejandro_64

Photos is a self-contained image database. I wouldn’t recommend trying to hack around on it. You would likely corrupt the database. Just manually go though and delete any duplicate images. It is tedious, but easy enough. You can select multiple images and delete them in batches. If you select the first image to remove, that would probable be the JPEG. It doesn’t matter that much. HEIC can be smaller, but it is also a lossy format. The only way to get an actual “orignal” iPhone image is with a newer phone that supports ProRaw.

Feb 5, 2022 9:13 PM in response to VikingOSX

"If Beyond Compare can do the job, then I would suggest you use it."


Partially.


Long story short: Can't figure out how to compare files in Beyond Compare by creation date instead of filename.


I exported duplicates from photo library to two folders - JPG and HEIC. Separated them by Smart Albums. Now I can operate them as files and after cleanup procedures export back to Pholo library. Just have to make no mistakes! =)


Turned out that some absolutely different photos have the very same filename, though different formats (and file extensions) - JPG and HEIC. (Clarification example: Files img1234.jpg and img1234.heic in approx 10% cases have different contents. (I wonder how THAT could happen.)


So, the task now is to compare files not by filename but by timestamp in metadata. The only common criteria of identical JPG and HEIC is Composite Creation Date.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Compare two folders contents by filename

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.