FTPGETDIFF         Get specific changes within FTP site file system

Top  Previous  Next

Syntax:

FTPGETDIFF

[ path ] [ dbfile ]

Arguments:

[ path ]

Optional Variable or string defining the remote path from which to begin looking for differences; if omitted, the current remote working folder is used and [ dbfile ] defaults "snapshot_site.sql".

 

[ dbfile ]

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

Options:

None

 

 

 

This script command is used in conjunction with the FTPSNAPSHOT and FTPDIFF script commands to locate individual file differences (i.e., change in size, date/time stamp) within a specified directory (and optional subdirectory) tree within an FTP site.

 

FTPSNAPSHOT is the first step to establish a baseline (or “snapshot”) of the specified directory(s) from which to determine if any file(s) change and FTPDIFF 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 FTPDIFF command. If omitted the default “snapshot_site.sql” file is used.

 

When FTPGETDIFF finds a changed file, the full path name of the changed file is returned in the %ftpdifffilepath script variable, just the file name itself in %ftpdifffilename, a description of the difference found is returned in the %ftpdifffiletext script variable, and a corresponding numeric representation is saved in the %ftpdifffileid script variable. The sequential file number for this difference is returned in the %ftpdiffnum 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_DATETTIME

5004

** File date/time stamp has changed

 

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

 

;; the FTPSNAPSHOT command must have been executed previously

FTPDIFF "*"

:loop

FTPGETDIFF

IFERROR $ERROR_READ_EOF GOTO done

SET Diff = "File: " + %ftpdifffilepath + " " + %ftpdifffiletext

WRITEFILE "differences.txt" Diff /append

GOTO loop

:done

 

The following example shows how all new files found are downloaded from an FTP site.

 

;; the FTPSNAPSHOT command must have been executed previously

FTPDIFF "*"

:loop

FTPGETDIFF

IFERROR $ERROR_READ_EOF GOTO done

IFNUM!= %ftpdifffileid $DIFF_FILE_IS_NEW GOTO loop

RCVFILE %ftpdifffilename

GOTO loop

:done

 

Important

The success of this command depends on Robo-FTP's ability to automatically read and understand the directory listings returned by the remote site.  It is not uncommon for HTTP/HTTPS sites to fail to return any directory listings or to return listings in an unsupported format.  Contact technical support if you have an urgent need related to a directory listing format that is currently unsupported.

 

Related Commands: FTPDIFF, FTPDIFFREWIND, FTPSNAPSHOT

See Also: GETDIFF