Find duplicate files in SharePoint Online in 2 ways. Group a library view by Name to spot repeats across folders. Use a PnP PowerShell hash test when copies carry new names. Microsoft shows that script in a Microsoft Q&A answer. Check size, dates and versions before you delete a copy. Deleted files wait in the Recycle Bin of the site for 93 days. Start with the view because it needs no code.
Your library grows and the same contract sits in three folders. You scroll, you guess and you fear deleting the wrong copy.
Microsoft gives no duplicate finder button for a library. You get 2 workable ways to find the duplicate files in a SharePoint Online library, a safe delete routine and the limits I check first.
Why does SharePoint Hold Duplicate Files?
SharePoint blocks two files with the same name in one folder. Copies appear when people upload the same file to a second folder or save it under a new name.
That makes two kinds of duplicates. The same name sits in different folders or the same content sits under different names.
Which Way Fits Your Library?
The table shows what every way catches and where it fails.
| Way | Finds | Misses |
|---|---|---|
| Grouped library view | Repeated names across folders | Copies saved under a new name |
| PnP PowerShell hash test | Copies with identical content and any name | Files that differ by one edit |
How do You Spot Duplicate Files in a SharePoint Library With a View?
Who it suits. Library owners who work in a browser. Extra application. None, because a browser is enough.
Microsoft says you can sort, filter and group a view from the column headings. Grouping by Name puts repeats side by side.
- Open the library. Go to the document library you want to check.
- Show files from every folder. Open Edit current view from the View options menu and set the Folders option to show items without folders.
- Group by Name. Select the Name heading and choose Group by.
- Look for groups with two files. A group holds the same name from different folders.
- Compare the copies. Check the Modified date, the editor and the file size.
- Save the view. Select Save view as so you can repeat the check next month.
Heads Up. A library view stops at the list view threshold of 5,000 items on a large library. The guide on SharePoint lists that do not show all items explains the cause.
How does a Hash Test in PnP PowerShell Find Copies With New Names?
Who it suits. Admins who write scripts. Extra application. PnP PowerShell.
A Microsoft engineer answered this question on Microsoft Q&A with a script that compares file content and not names. A copy named Final v2 still shares a hash with the original.
- Connect to the site. Sign in to the site with PnP PowerShell.
- List the libraries. Skip hidden libraries, empty ones, Site Pages, Style Library and Preservation Hold Library.
- Hash every file. The script opens the binary stream of a file and computes an MD5 hash.
- Record the details. Store the file name, hash, URL and file size.
- Group by hash. Keep only the groups that hold more than one file.
- Export to CSV. Open the report and choose which copies to delete.
Test the script on one small library first because it opens the stream of every file. Your tenant policy decides who can use PnP PowerShell.
How do You Confirm a Copy is Safe to Delete?
Matching names do not prove matching content. Compare before you act.
- File size. Different sizes mean different content.
- Modified date. The newer file holds the latest edits in most cases. Open both.
- Version history. Check whether people edited the file in place or whether someone saved a copy.
- Links. A shared link points to one location and deleting that copy breaks it.
What Happens When You Delete a Duplicate File?
Microsoft says deleted files go to the site Recycle Bin and stay there for 93 days. You can restore them to the original location during that time.
Deleting an item from the site Recycle Bin moves it to the second stage bin. Only a site collection admin can restore items from there.
What Limits Apply When You Look for Duplicates?
- Name checks. A grouped view finds the same name and nothing else.
- View size. A large library hits the 5,000 item threshold.
- Hash checks. A hash only matches files with identical content.
- Script scope. The Microsoft Q&A script works on one site at a time.
- Tenant wide search. Microsoft names no built in duplicate report for the entire tenant.
Which Habits Stop Copies From Piling up?
- Share a link. Send a link to the file and do not upload a second copy.
- Name files with care. A clear naming rule stops Final v2 copies.
- Use one home folder. Store every document type in one agreed place.
- Review monthly. Open the saved grouped view and clear new copies early.
Which Mistakes Cost the Most When You Remove Duplicates?
- Deleting by name alone. Matching names can hide different content.
- Skipping the version check. You can remove the file that holds the latest edits.
- Ignoring shared links. Colleagues lose access when the linked copy disappears.
- Testing the script on a large library. Start small to see how long the hashing takes.
My Verdict on Finding Copies in SharePoint Online
Start with a grouped view because it costs nothing and shows the obvious copies. Add the hash test when people rename files.
Check size, dates and versions before every delete and keep the 93 day Recycle Bin window in mind.
Key Takeaways
- SharePoint blocks a repeat inside one folder but allows it across folders.
- A grouped view finds the same name and a hash test finds the same content.
- Deleted files stay in the site Recycle Bin for 93 days.
- Compare size, date and version history before you delete.
Next Read
Frequently Asked Questions
Can SharePoint Find Duplicate Files by Itself?
No, Microsoft shows no duplicate finder button in a library. Use a grouped view or a script.
Can Two Files have the Same Name in One Folder?
No. SharePoint blocks the same name inside one folder. The same name can still appear in different folders.
Can a View Show Files From Every Folder Together?
Yes when you edit the view to show items without folders. Group by Name then lines up the same name from different folders.
Does a Hash Test Find Renamed Copies?
Yes. The Microsoft Q&A script compares file content. A renamed copy shares the hash of the original. One edit changes the hash.
Can I Restore a Duplicate I Deleted by Mistake?
Yes for 93 days. Open the Recycle Bin of the site and restore the file to its original location.
Can a Site Member Restore From the Second Stage Bin?
No. Only a site collection admin can restore items from the second stage Recycle Bin.
Does the PowerShell Script Check Every Site?
No because the Microsoft Q&A script connects to one site at a time. Repeat it for every site you want to check.
Published 2 November 2026. View steps come from Microsoft's page on how to create or change the view of a list. Recycle Bin facts come from Microsoft's page on how to delete items or empty the Recycle Bin. The hash check follows a Microsoft Q&A answer on how to display duplicate documents in SharePoint. Microsoft updates menus so check them before you plan.