Find and delete duplicates within a specific folder

Hello,
Is there a way to

  • look within a specific folder, for example downloads
  • look for and delete all duplicates based on file content (not just filename or deleting file versions)****
    thanks very much

Probably the way I would go about this would be to keep track of the seen MD5s. So something like

  • Clear a variable Seen
  • For Each file in the specified folder.
    • Make sure the file is a file (Get File Attribute)
    • Get the MD5 of the file (Execute Script)
    • If the MD5 appears in Seen
      • Trash the file
    • Else
      • Append “,MD5” to the Seen variable

Of course, you’re talking about a macro designed to trash a bunch of files, so use with extreme caution - I’d probably just have the macro report all the duplicates and manually trash them after verification, unless this is really an ongoing problem or the folder is expected to have lots of duplicates.

1 Like

thank you very much Peter.
After reading your note, I will be more cautious and include either an intermediary step as you recommend or perhaps a pre-trash bin folder.

Here is an inexpensive commercial product that will do this for you:
Rid Your Mac of Duplicate Files With Gemini 2—Now 30% off

I've not used it, but it seems to be recommended by Macworld.

1 Like

Thanks very much !!
I purchase Gemini 2, a great app, for only $13 via Macworld instead of $28 in the app store, so I am doubly grateful. I tried out Gemini and it is great indeed.
MacPaw appears to have taken the duplicates feature out of CleanMyMac and made it into a stand alone app.
Fantastic advice !!

1 Like