GETDIFF         Get specific changes within local PC file system

Top  Previous  Next

Syntax:

GETDIFF

[ dbfile ]

Arguments:

[ dbfile ]

Optional Variable or string defining an alternative to the default “snapshot_local.sql” database file where a previous snapshot and diff comparison has been saved.

Options:

None


 

 

This script command is used in conjunction with the SNAPSHOT and DIFFscript commands to locate individual file differences (i.e., change in size, date/time stamp) within a specified folder (and optional subfolder) tree within the local PC file system.

 

SNAPSHOT is the first step to establish a baseline (or “snapshot”) of the specified folder(s) from which to determine if any file(s) change and DIFF is used subsequently to compare the current state of the file system with what was saved in [ dbfile ]. Any changes found are saved back into the same database file which are then processed by this script command.

 

If the [ dbfile ] argument is specified it must be the name of a database file previously created by a previous DIFF command. If omitted the default “snapshot_local.sql” file is used.

 

When GETDIFF finds a changed file, the full path name of the changed file is returned in the %difffilepath script variable, just the file name itself in %difffilename, a description of the difference found is returned in the %difffiletext script variable, and a corresponding numeric representation is saved in the %difffileid script variable. The sequential file number for this difference is returned in the %diffnum script variable.

 

The possible differences are:

$DIFF_FILE_NOT_FOUND

5001

** File not found

$DIFF_FILE_IS_NEW

5002

** File is new

$DIFF_FILE_SIZE

5003

** File size has changed

$DIFF_FILE_SIZE

5004

** File date/time stamp has changed

 

 

GETDIFF must be performed once for each difference that was detected by the DIFF command and correspondingly saved in [ dbfile ]. What follows is a simple example that shows how GETDIFF might be used inside a loop to write all the differences found to a text file.

 

;; the SNAPSHOT command must have been executed previously

DIFF DIALNET"*.*"

:loop

GETDIFF

IFERROR $ERROR_READ_EOF GOTO done

SET Diff = "File: " + %difffilepath + " " + %difffiletext

WRITEFILE "differences.txt" Diff /append

GOTO loop

:done

 

The following example shows how all new files found are uploaded to an FTP site.

 

;; the SNAPSHOT command must have been executed previously

DIFF "*.*"

:loop

GETDIFF

IFERROR $ERROR_READ_EOF GOTO done

IFNUM! %difffileid $DIFF_FILE_IS_NEW GOTO loop

SENDFILE %difffilepathSENDFILE

GOTO loop

:done

 

Related Commands: DIFF, DIFFREWIND, SNAPSHOT