FTPGETDIFF Get specific changes within FTP site file system |
Top Previous Next |
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:
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
|