Forum Discussion

QuinnQuinn's avatar
QuinnQuinn
Silver Contributor
Sep 23, 2024
Solved

How can I find and remove duplicate files on Windows 10/11?

I was organizing my computer recently and found a lot of duplicate files. I don't know how to deal with them. I use Windows 10 and want to find a simple way to find and remove duplicate files. Is there any recommended software or steps? I hope to find all the duplicate files at once, clean them up quickly, and free up some space. Thank you for your help!

20 Replies

  • Joohnei's avatar
    Joohnei
    Copper Contributor

    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 Domaingue's avatar
      Nigel Domaingue
      Copper 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.
    • vientis's avatar
      vientis
      Copper 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.

  • Wemaiah's avatar
    Wemaiah
    Copper Contributor
    While Storage Sense is a super handy tool for finding and remove duplicate files on Windows 11, it's not really designed for hunting down and deleting duplicate files specifically. Unlike specialized duplicate file finders, Storage Sense doesn't have the smarts to decide which duplicate to keep and which to toss. It's just cleaning up what it thinks is junk, which could lead to you losing important files if you're not careful.
    • Wemmas's avatar
      Wemmas
      Copper Contributor

      Wemaiah While Storage Sense is the default duplicate file remover for Windows 11 and is great for managing disk space by removing old or temporary files, it doesn’t scan for or remove duplicate files. If your primary goal is to find and delete duplicates, you’ll need to use a third-party duplicate file finder tool, as Storage Sense won't specifically target duplicate files.

       

      To effectively find and remove duplicate files on Windows 11, consider using third-party free duplicate file remover for PC, which are specifically designed for this purpose. These tools will scan your system for duplicates based on criteria such as file name, size, and content, and allow you to safely remove them.

  • VioletEdwards's avatar
    VioletEdwards
    Copper Contributor

    QuinnQuinn Storage Sense is a built-in feature in Windows 11 designed to automatically free up disk space by deleting unnecessary files, such as temporary files, files in the Recycle Bin, and old downloads. It’s a handy tool for managing your storage space by keeping your system clean and running efficiently. 

     

    How to remove duplicate files on Windows PC with Storage Sense:

     

    1. Go to Settings > System > Storage. Under Storage management, click on Storage Sense.
    2. Toggle the Storage Sense switch to turn it on. Click on Configure Storage Sense or run it now to adjust settings.
    3. Choose when you want Storage Sense to run automatically (e.g., during low disk space, daily, weekly, or monthly).
    4. After configuring, you can click on Run Storage Sense now to perform an immediate cleanup.
  • Odityaz's avatar
    Odityaz
    Copper Contributor

    You can manually search for duplicates using Windows File Explorer by sorting files by name, size, or date. Use the search filter to narrow down files with the same name or type. This is the simple way to find duplicate files on Windows 11 or Windows 10.

     

    Pros: No need to install any additional software.

     

    Cons: This method can be time-consuming and may not catch all duplicates, especially those with different file names.

  • LukeUnderwood's avatar
    LukeUnderwood
    Copper Contributor

    Recently, when I was organizing my computer, I found that many duplicate files took up a lot of space. After using DupFiles Cleaner, the effect is really good. The scanning speed is fast, and it can clean all duplicate files at once, which helped me free up a lot of space.

     

    I get it here: (works for me)

    https://www.techsrader.com/find-and-remove-duplicate-files

     

    The operation is also very convenient, which is especially suitable for organizing computers.

Resources