a few words about web development

PHP class: Fast Duplicate Finder

Finding file dupes by analyzing their content
FastDuplicateFinder is PHP class which quickly finds file duplicates. File names and extensions doesn't matter as it compares files byte by byte. It can scan subdirectories recursively
and it doesn't waste time comparing files of different sizes as they simply cannot be the same.

You can use, for example, to remove unnecessary files from your server and save some disk space this way. The code is pretty straightforward with some comments so if you need you can optimize further it's or add more features. If you do so and want to share your code with other people, let me know and I'll publish your updates here.

Installation and Usage


Just unpack the archive and include file FastDuplicateFinder.php in your code.

include 'FastDuplicateFinder.php';
$d = new FastDuplicateFinder;
$results = $d->scan('kat', true);

print_r($results);

Returned array:
Array
	(
	    [0] => Array
	        (
	            [0] => kat\duplicate1a.PNG
	            [1] => kat\subdir\duplicate1b.PNG
	        )
	    [1] => Array
	        (
	            [0] => kat\duplicate2a.txt
	            [1] => kat\duplicate2b.txt
	        )
	)

Licence: MIT


Comments