# Find duplicate files and clear the extra copies

> Markdown version of https://stella.sh/how/pc-cleanup/find-duplicate-files for agents and LLMs.
> Find exact duplicate files in Documents and Downloads, even renamed ones, keep one of each and send the rest to the Trash, with PowerShell or Stella (stella.sh).

Exact duplicates have identical contents, whatever their names, so compare files by a fingerprint (a hash), not by name or size. PowerShell's `Get-FileHash` on Windows or `shasum` in the Mac Terminal lists files that match, and you move the extras to the Recycle Bin or Trash yourself. Stella (stella.sh) does the comparison on your computer, keeps the copy with the tidiest name, moves the rest to the Trash so you can restore them, and leaves look-alikes that aren't really the same alone.

- Checked: 14 November 2026
- Stella does it on: Windows, Mac, Linux

## Stella doing it

Recorded 14 November 2026 on Linux (Omarchy) with Claude Code with Opus, on a Claude plan.
Result: Under a minute. Checked afterwards against an answer key written before the run: exactly one copy left of each of the 12 duplicated files, all 29 files that aren't duplicates kept (look-alikes included), all 16 extra copies recoverable in the Trash, and the tidy copy kept each time. The files are made up for this run, with renamed copies and look-alikes on purpose. The work is sped up 3×.

Video (44 s): https://stella.sh/media/proofs/pc-cleanup/find-duplicate-files/proof.mp4

Transcript:

- 0:00 Stella on a Linux computer. Documents and Downloads hold the same files saved twice, some under new names.
- 0:02 The prompt: find exact duplicates, keep one of each, extras to the Trash.
- 0:13 Stella replies: it compares contents, keeps the cleaner name and sends every extra to the Trash.
- 0:19 Comparing the files, sped up 3×.
- 0:29 Done: 16 extra copies in the Trash from 12 sets, look-alikes left, and a list of what moved.

What Stella does:

1. Goes through Documents and Downloads, subfolders included, 60 files, and compares them by content, not name
2. Finds 12 sets of identical files, including renamed ones such as a phone photo saved again as Holiday 1.jpg
3. Keeps the copy with the clearer name, or the one in Documents, and moves 16 extra copies to the Trash after checking each byte for byte
4. Leaves alone files that only look alike: two different Notes.txt, a budget that differs by a row, a photo re-saved smaller
5. Leaves three empty files in place and offers to trash them, and saves a list of what went to the Trash and the copy each matched

## The prompt to paste

```text
My Documents and Downloads folders are full of the same files saved twice. Find all the exact duplicates and get rid of the extra copies, keeping one of each. Put the extras in the Trash rather than deleting them.
```

## Find them yourself

1. **Windows: list duplicates with PowerShell.** Open PowerShell and run `Get-ChildItem $HOME\Documents,$HOME\Downloads -Recurse -File | Get-FileHash | Group-Object Hash | Where-Object Count -gt 1`. Each group is a set of files with identical contents; expand a group's Group property to see the paths.
2. **Mac: list duplicates in Terminal.** Finder has no duplicate finder. In Terminal: `find ~/Documents ~/Downloads -type f -exec shasum -a 256 {} + | sort | uniq -w64 -D` prints files with the same fingerprint next to each other. (`uniq -w` needs GNU uniq; on a stock Mac, sort the list and read down it.)
3. **Decide which copy to keep.** Keep the one with the clearest name in the folder you actually use. Names with (1), copy or a camera number are usually the extras.
4. **Move extras to the Trash, not away for good.** Delete them in File Explorer or Finder so they go to the Recycle Bin or Trash. Leave it a few days before emptying, in case something was needed.

## Where Stella stops

- Only exact copies. An edited version or a photo re-saved at another quality is a different file and is kept; for similar-looking photos see [find duplicate photos](https://stella.sh/how/photos-files/find-duplicate-photos).
- Files in a cloud-synced folder can come back from the cloud copy, or the deletion can sync to your other devices. Check how your sync service handles the Trash.
- File names and folder layout go to the AI model you use in Stella; the files themselves are compared on your computer.
- Recorded on Linux, where the Trash is a folder in your home. On a Mac or Windows PC Stella uses the Trash or Recycle Bin and may install Python first, which wasn't recorded.

## Questions

**Does Windows 11 have a duplicate file finder?**
No. Storage Sense clears temporary files but doesn't look for duplicates. PowerShell's `Get-FileHash` does it without installing anything.

**Are two files with the same name duplicates?**
Not necessarily. Two different Notes.txt files share a name but not their contents. Only identical contents make a duplicate, and renamed copies count too.

**Will it free a lot of space?**
Only as much as the extras take up. In the run it was about 156 KB of small documents. For space, see [find large files taking up space](https://stella.sh/how/pc-cleanup/find-large-files-taking-up-space).

**What about two copies of a whole folder?**
See [compare two folders](https://stella.sh/how/files-folders/compare-two-folders), which merges an old copy into a new one without losing anything.

**Is Stella free for this?**
Yes. Free with the ChatGPT or Claude plan you already have. Sign in with your ChatGPT plan, or use your Claude plan through Claude Code, and this task costs nothing extra. New accounts also get a small free trial of Stella’s own models.

**Can I control what Stella changes on my computer?**
Yes. Stella works on Windows, Mac and Linux with your own files and shows each step in the chat, so you can watch it and stop it at any point. Tell it what it may not do, as the prompts on these pages do (“don't delete anything without asking”). In the Downloads recording it deleted nothing until it was told to go ahead. It also refuses commands that would wipe a whole disk, your home folder or system folders.

Sources: [Microsoft Learn: Get-FileHash](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash), [Apple Support: Free up storage space on your Mac](https://support.apple.com/en-us/102624).

## Related problems

- [Find duplicate photos, including resized copies](https://stella.sh/how/photos-files/find-duplicate-photos.md)
- [Find what's taking up space on your computer](https://stella.sh/how/pc-cleanup/find-large-files-taking-up-space.md)
- [Compare two folders and copy what's missing](https://stella.sh/how/files-folders/compare-two-folders.md)
- [Organize a messy Downloads folder](https://stella.sh/how/pc-cleanup/organize-downloads-folder.md)
- [Delete all empty folders at once](https://stella.sh/how/pc-cleanup/delete-empty-folders.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
