Forum Discussion
Best duplicate file checker for quickly finding duplicates on Windows or Mac?
You can use PowerShell or Command Prompt (CMD) to find duplicate files by comparing file names, sizes, or hashes.
Method 1: Find Duplicates by File Name & Size (Fast but Less Accurate)
Get-ChildItem -Recurse -File | Group-Object Name, Length | Where-Object { $_.Count -gt 1 } | Select-Object -ExpandProperty Group | Format-Table FullNameWhat it does: Lists files with the same name and size in a folder and its subfolders.
Limitation: Different files can have the same name/size, so this isn't foolproof.
Method 2: Find Exact Duplicates Using File Hashes (MD5/SHA1) (Most Accurate)
Get-ChildItem -Recurse -File | Group-Object { (Get-FileHash $_.FullName -Algorithm MD5).Hash } | Where-Object { $_.Count -gt 1 } | ForEach-Object { $_.Group | Select-Object FullName, Hash }What it does:
- Scans all files recursively.
- Computes an MD5 hash (unique fingerprint) for each file.
Groups files with identical hashes (true duplicates).
No duplicate file checker required. It is a bit slower but 100% accurate since even renamed files are detected.
I want exact matches only. I'm not familiar with using command line tools. If I use this command, what does it do with the results. Does it print a list to a file? Does it automatically delete duplicates (I hope not)?