PHP Classes

PHP Duplicate File Remover: Remove files that exist more than once in a folder

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 153 All time: 9,051 This week: 65Up
Version License PHP version Categories
duplicatefileremover 1.0.0The PHP License5PHP 5, Files and Folders


This class can remove files that exist more than once in a folder.

It provides a function that can traverse a given directory recursively to check if it contains the same contents by comparing the SHA1 hash value of the contents of each file that it finds.

The class removes the finds that appear more than once.

It can also remove all files at once using another function.

Innovation Award
PHP Programming Innovation award winner
December 2021

Prize: One downloadable copy of CodeLobster Professional
Some applications need to store information in many files that take a lot of disk space.

Sometimes files are saved twice or copied to a different directory, which takes needless space.

This package provides a solution for this problem by finding and removing duplicate files inside a folder.

Manuel Lemos
Picture of Johnson Omotosho
Name: Johnson Omotosho is available for providing paid consulting. Contact Johnson Omotosho .
Classes: 2 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 415237 in Nigeria Nigeria
Week rank: 258 Up9 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x




use Amantosh\DuplicateFileRemover as Remove;


$sample_path = "path/to/a/folder/";

$ins = new Remove($sample_path);




Removing duplicate files on server using PHP


There are sometimes when we have duplicates files on our systems either through multiple uploads which are taking up space. This tool can help you remove them and leave out one.

  Files folder image Files  
File Role Description
Plain text file class.duplicateFileRemover.php Class Class source
Accessible without login Plain text file Doc. Documentation
Accessible without login Plain text file sample.php Example Example script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,051
This week:65Up