PHP Classes

PHP Compare Directories: Compare files in two directories and find changes

Recommend this page to a friend!

  Author Author  
Picture of Larry Wakeman
Name: Larry Wakeman is available for providing paid consulting. Contact Larry Wakeman .
Classes: 4 packages by
Country: United States United States
Age: 71
All time rank: 1250174 in United States United States
Week rank: Not yet ranked
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can compare files in two directories and find changes.

It traverse two given directories to retrieve the lists of files.

The class can determine which files were added, removed or changed.

This class has been very useful for me in two instances, the first is
to determine filed that have been modified by comparing a sites files
to distribution files and the second is to locate infections on a site
by comparing the site files to a saved copy of a site. I save copies
of all sites i work on.

To use:
	initialize the class:
	    include ('compare.class.php');		// Load the class
	    $cmp = new compare();				// Initialize the class
	set up the source and update(pristine) directories:    
	    $cmp->set_source($dir.'\Source');	// Directory where Source files are
	    $cmp->set_update($dir.'\Update');	// Directory where pristeen files are
	do the compare:
	    $cmp->do_compare();					// Do the compare
	and get the reults:
	    $removed = $cmp->get_removed();		// Get the results
	    $added = $cmp->get_added();			// ...
	    $changed = $cmp->get_changed();		// ...
It is up to you to format the results.

  Classes of Larry Wakeman  >  PHP Compare Directories  >  Download Download .zip .tar.gz  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP Compare Directories
Base name: compare-directories
Description: Compare files in two directories and find changes
Version: 1.0.0
PHP version: 5.3
License: GNU General Public License (GPL)
All time users: 853 users
All time rank: 4078
Week users: 0 users
Week rank: 158 Equal
  Groups   Rate classes User ratings   Applications   Files Files  

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes

  Innovation Award  
PHP Programming Innovation award winner
November 2013

Prize: One downloadable copy of Komodo IDE
Some sites that are victims of security attacks often have their files changed.

This class provides a solution to detect if site files were changed by comparing the site directory with another directory where a copy of the site files is stored.

Manuel Lemos

  User ratings  
Not enough user ratings

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Plain text file compare.class.php Class Compare Class Source
Accessible without login Plain text file index.php Example A simple example
Accessible without login Plain text file readme.txt Doc. Documentation

Install with Composer Install with Composer - Download Download all files: compare-directories.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.