Forum Discussion
How can I find and remove duplicate files on Windows 10/11?
- Aug 14, 2025
I’ve used AnyDupeCleaner myself, and it saved me tons of time—just scanned, picked the dupes, and deleted them in seconds! Super handy if you’ve got messy folders like I did.
Check this tutorial: https://www.pcfixtips.com/find-and-remove-duplicate-files
Definitely worth a try!
Using the Command Prompt to find and remove duplicate files on Windows 11 involves utilizing PowerShell or batch scripts. This approach is more technical but can be effective for users who are comfortable with command-line tools. Here's how you can do it with a batch script:
Get-ChildItem -Recurse |
Get-FileHash |
Group-Object Hash |
Where-Object { $_.Count -gt 1 } |
ForEach-Object { $_.Group | Select-Object -Skip 1 } |
Remove-Item
After running the script, you can verify that duplicates are removed by checking the directory manually or by running the script again to see if any duplicates remain.
This is a very powerful method to find and remove duplicate files on Windows 10 and can handle large directories efficiently, but it's also risky because it involves directly deleting files. If you're not comfortable with this approach, using a dedicated duplicate file finder tool might be safer.
- Nigel DomaingueAug 02, 2025Copper Contributor
I found this answer whilst looking for a solution to the same problem as the OP. I like the concept of the solution, but like Joohnei and vientis already stated, it is risky. Here are my additional comments, from my own attempts to use and adapt this method.
- To avoid actually deleting the files, add the -WhatIf option to Remove-Item and the output will tell you what it would have done
- BUT, this method works using common hashtags, not the filename. So, if you have a file "Picture of my dog.jpg" and a copy of it, "Picture of my dog - Copy.jpg", they have different filenames but the same hash. This is good, as it finds true duplicates, but can be confusing.
- The printed output from Remove-File -WhatIf will only tell you the instance targetted for deletion, not any other filenames which share the hashtag that are retained.
- You have no control over which one is deleted. It will leave the first instance it finds alone and delete the others. So, if you have a two photos of the same filename where one is in an unsorted folder and the other is in an organised location, it might delete the organised one that you had taken time to prioritise.
Therefore, I offer the following variation, which will present all the filename instances for manual organisation:
$startDate = Get-Date ; Write-Output " Starting filecheck at $($startDate.ToString())"; Get-ChildItem -recurse | Get-FileHash -erroraction silentlyContinue | Group-Object Hash | Where-Object { $_.Count -gt 1 } | ForEach-Object { $_.Group } | Format-Table -Wrap $endDate = Get-Date ; Write-Output " Task complete at $($endDate.ToString())" ; Write-Output " File check took $(($endDate - $startDate).TotalMinutes.ToString('0.0')) total minutes"
Key features:
- Added -erroraction silentlyContinue in case there are any paths in the tree where you do not have full access or control
- Grabs a start and end date so that if you have a large filesystem you can find out later how long it took
- $startDate.ToString() ensures the date is presented in your preferred format. Else it defaults to the illogical US date format ;)
- Format-Table -Wrap ensures that long filenames are presented in full. Else they might be truncated, which doesn't help you to find them to manually organise them. But you will have to manage the word-wrap.
- vientisSep 24, 2024Copper Contributor
Joohnei Before running any script that deletes files, it's crucial to back up your data to avoid accidental loss. In addition, the command line is powerful, and mistakes can lead to data loss. Double-check commands before executing them, especially those that delete files.
This method is powerful and can handle large directories efficiently, but it's also risky because it involves directly deleting files. If you're not comfortable with this approach, using a free duplicate file remover tool might be safer when you are using Windows 11 or Windows 10.