PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 153 All time: 9,054 This week: 51Up
Version License PHP version Categories
duplicatefileremover 1.0.0The PHP License5PHP 5, Files and Folders
Description 

Author

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
Winner


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 <contact>
Classes: 2 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Recommendations

Example

<?php

use Amantosh\DuplicateFileRemover as Remove;

require
"class.duplicateFileRemover.php";

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


$ins = new Remove($sample_path);

$ins->start_process();


Details

DuplicateFileRemover

Removing duplicate files on server using PHP

Purpose

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 (3)  
File Role Description
Plain text file class.duplicateFileRemover.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file sample.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:153
This week:0
All time:9,054
This week:51Up