VBA or Script to identify files which are duplicate in a folder

i have a very tricky situation with my files.

i have a folder which has duplicates like this, how can i delete one copy of them and delete the other so that there is unique left?

is there any way to do this automatically without manual process?

Anonymizing-Data.xlsm
Anonymizing-Data-wngz.xlsm

Creating-A-Search-Box-40t1.xlsm
Creating A Search Box.xlsm

Contacts List Template.xlsm
Contacts-List-Template.xlsm
LVL 6
Flora EdwardsMedicineAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
I don't have any suggestions as that is not my field but no doubt the question will be asked; how will you determine which file to keep and which to delete?

Thanks
Rob H
KimputerIT ManagerCommented:
VBA could do the trick,

enumerate all files in two loops, compare MD5 hash of the two files. Delete if the same.
To reduce system load, only compare if first x letters of the file name (maybe 3 or 5?) are the same.
However, you will NOT have a choice for the file name (if the shorter file name is prettier, but it's the one in the first loop, you obviously can't delete it).
David Johnson, CD, MVPRetiredCommented:
I would use a utility like beyond compare
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

MacroShadowCommented:
Or you can use this simple ExcelDupeCleaner I threw together for you.
ExcelDupeCleaner.xlsm

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Flora EdwardsMedicineAuthor Commented:
thanks everyone.

MacroShadow Solution was absolutely perfect.  thanks very much. this is extraordinary
MacroShadowCommented:
You're welcome, glad to help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.