|
Top Previous Next |
This script command is used in conjunction with the SNAPSHOT and DIFF script 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 %difffilenname, 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:
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.
DIFF "*.*" :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 the remote system.
DIFF "*.*" /incldirs :loop GETDIFF IFERRORIFERROR $ERROR_READ_EOF GOTO done IFNUM!= %difffileid $DIFF_FILE_IS_NEW GOTO loop SENDFILE %difffilepath GOTO loop :done
Related Commands: DIFF, DIFFREWIND, SNAPSHOT
|