As you work on your daily tasks, you are surely going to accumulate data on your Windows machine. Some of which will be duplicates. These duplicates not only take up valuable space but also lead to confusion and inefficiency.

For this reason, we are going to check some ways you can use to find duplicate files on your Windows PC and act on them accordingly.

Finding Duplicated on Windows 11

Fortunately, Windows provides various tools for this. Including but not limited to the search functionality, and using the command prompt. I will also add third-party plugins for variety. Let's start with the search functionality.

Method 1: Using the Windows Search Feature

The search bar within the file explorer is super useful for cases like these. We can filter globally or inside folders depending on the query. To use the Search feature to find duplicate files, follow the steps below.

  1. Open the file explorer. You can use the shortcut Win + E to achieve this.

  2. The next step is to navigate to the folder where you suspect duplicates may exist.

  3. On the search bar, type kind followed by the file type. Here is an example. kind:jpg. When done press the Enter key.

    This search query will find and list all the files with the .jpg extension. This makes it easy to see what files you have and find the duplicates easily.

Method 2: Using the Command Prompt

The command prompt is a very powerful interpreter offering you the ability to execute commands. These commands tell the computer what to do. So in this case, we want to tell the computer to find duplicate files using the command prompt. Let's see how.

  1. Start by opening up the command prompt or PowerShell. You can use the shortcut Win + X to open up the power user menu then select Terminal (Admin).

  2. Using the cd command, navigate to the directory you want to scan for the duplicate files. for example,

    cd C:\Users\Geekbits\Documents
    
  3. Once you are in the right folder, use the command below to find the duplicates.

    Get-ChildItem -Recurse | Group-Object Length | Where-Object { $_.Count -gt 1 } | ForEach-Object { $_.Group }
    

    Let's understand what these cmdlets do.

    • Get-ChildItem -Recurse: Retrieves all files in the specified directory and its subdirectories and pipes the result to the Group-Object Length.

    • Group-Object Length: Groups the files based on their file size. the result is piped through to the Where-Object.

    • Where-Object { $_.Count -gt 1 }:

      • Where-Object is a cmdlet that filters objects based on a specified condition.

      • { $_.Count -gt 1 } is a script block that checks whether the count of items in each group is greater than 1.

        This part of the command filters out groups that don't have duplicates, leaving only those groups with more than one file of the same size. The result is then piped down to the ForEach-Object.

    • ForEach-Object { $_.Group }:

      • ForEach-Object is a cmdlet that operates on each object in a collection.
      • { $_.Group } is a script block that retrieves the actual items within each group.

      This part of the command extracts and displays the duplicate files within each group based on their size.

    In summary, this command sequence identifies and groups files by size. filters out groups with only one file and then displays the duplicate files within each group and their paths.

  4. Once you have the duplicate files, you can manually delete or move the duplicates. You can also add the following lines of code inside your command sequence to delete the files.

    foreach ($file in $_.Group) {
            Remove-Item -Path $file.FullName -Force
        }
    

    Here is the explanation of the code.

    • foreach ($file in $_.Group): This loop iterates through each file in the group of duplicates.

    • Remove-Item -Path $file.FullName -Force:

      • Remove-Item is a cmdlet used to delete files or directories.
      • -Path $file.FullName specifies the full path of the file to be deleted.
      • -Force ensures that you won't be prompted for confirmation during the deletion process.

    Let's add this code to create the full command sequence that identifies duplicates and deletes them.

    Get-ChildItem -Recurse | Group-Object Length | Where-Object { $_.Count -gt 1 } | ForEach-Object {
        # Iterate through each group of duplicate files
        foreach ($file in $_.Group) {
            # Delete the duplicate file
            Remove-Item -Path $file.FullName -Force
        }
    }
    

Method 3: Using third-parties

There are several third-party tools that make file management super easy. This means they can help you find duplicate files on your machine.

  1. CCleaner: This widely-used utility offers a duplicate file finder feature, allowing users to scan and remove duplicate files effortlessly.
  2. Duplicate Cleaner: This is a dedicated duplicate file finder that provides advanced filtering options and helps users reclaim valuable storage space.
  3. Auslogics Duplicate File Finder: This tool is known for its simplicity, it quickly scans your system for duplicate files and presents them in a user-friendly interface. You can then do with the files as you please.

Summing up

Keeping your PC clean makes it so easy for you to do things efficiently. One of the ways to keep it clean is to eliminate duplicate files. This article shows some of the methods you can use to remove duplicate files and how to use them. For the third part plugins, You can use their documentation to learn how to use them. They are fairly simple to use though. You should have no trouble navigating through those apps.

That is all for this one. See you in the next one. Have a good one. Cheers.

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.