Forum Discussion
AvaAnderson
Aug 06, 2024Copper Contributor
How to Compare USB Flash Drive Folders for Duplicate Files
I have a USB flash drive filled with thousands of MP3 song files. Some are organized within an "Artist" folder, while others are scattered in a folder called "Random." I decided to revamp my music co...
Mousefluff
Apr 01, 2026Iron Contributor
I would use the command line in conjunction with PowerShell to compare them based on the MD5sum hash value, given it's faster and more efficient. Change both "E:\Folder_Name_Here\Subfolder_Name\" and "E:\\Folder_Name_Here\\Subfolder_Name\\" to match the single folder name you want to search, and "C:\Duplicate_Files.txt" to the full path, including the filename of the UTF-8 text document where the duplicate file search results / values will be stored:
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Set-Content -Path 'C:\Duplicate_Files.txt' -value (ls 'E:\Folder_Name_Here\Subfolder_Name\' -recurse | Get-FileHash -Algorithm MD5 | Group -Property Hash | Where { $_.Count -Gt 1 } | % { $_.Group } | Format-Table -Wrap -AutoSize -Property Path | Out-String -Stream -Width 32767 | Select-String -Pattern 'E:\\Folder_Name_Here\\Subfolder_Name\\')}"