Introduction and Scope

This class will finished below functions:

1)Get all files' name from a file

2).Use the command diff to compare all files.

3).log all changed filenames

4).Use the command tar and gzip to backup all old files.

5)Use the command cp to copy all new files into backup directory

6)Send email to alert us which files are changed.


private $listfilename;

This file store all files’ name we want to know wether have change.

private $backdir ;

This directory is used to backup new files..

private $logfilename;

This file is used to log the changed files’ name..

private $emailfilename;

This file store all emails’ address which we want to told them the changed files’ name.


public function set_listfilename($listfilename);

Set the absolute path of the list file.

public function set_backdir($backdir);

       Set the absolute path of backup directory.

public function set_logfilename($logfilename);

Set the absolute path of the log file.

public function set_emailfilename($emailfilename);

Set the absolute path of the email list file.

public function check_and_backup()

   Check all list files’ differ and log the differs and backup new files and send email.

How to use

$ck_bk=new check_backup("/usr/local/www/apache22/CRON/Test_jevons");



This will general default configure base on the directory of your inputing.

You must put the two files which are named file.list and email.list in your inputing directory.

$this->listfilename = $defaultdir."/file.list";

              $this->backdir = $defaultdir."/backup";

              $this->logfilename =$defaultdir."/backup.diff.log";

              $this->emailfilename =$defaultdir."/email.list";


file.list example






email.list example