Comparing File Dates and Times |
Top Previous Next |
Robo-FTP provides a set of commands permitting the date/time stamps of local and FTP site files to be compared against specified date and time strings or variables.
If you wish to compare a file date/time stamp against specified dates or times rather than against another file, the IFDATE and IFTIME script commands may be used. When used this way, the complete script command is formed by adding one of the following comparison operators:
The IFDATExx and IFTIMExx commands always compare the specified date or time against the date/time from the most recent file details obtained using the GETNEXTFILE, GETSITEFILE, GETFILE, or FTPGETFILE command. In other words, insofar as the IFDATE and IFTIME commands are concerned, GETNEXTFILE overwrites the saved date/time values from a previous GETSITEFILE, and vice versa.
The following example branches if the date of a local file obtained with GETNEXTFILE is found to be later than January 1, 2012.
GETNEXTFILE "*"
IFDATE> "01-01-12" GOTO new_file
The date variable or string must be in the format of mm-dd-yy or mm/dd/yy. (Note: Robo-FTP always uses the former format internally so that the date variable may be used in the creation of file names.) The time string must be in the format of hh.mm.ss, hh:mm:ss, hh.mm, or hh:mm. Seconds are ignored by the IFDATE and IFTIME commands.
The following example branches if the time on a remote site file obtained with GETSITEFILE shows that it was created after 1PM.
GETSITEFILE "*" IFTIME>= "13:00" GOTO new_file
Important If a given FTP site is hosted on a Unix system and the server file was last written to six (6) or more months prior to the current date, the comparison is based on the stored month, day, and year - but the server file time is assumed to be 12:00 AM (since the actual time is not available to Robo-FTP for comparison purposes).
See Time Zone Differences for information on how to account for time zone differences between where Robo-FTP is located and where the server is located or if the server defaults to GMT when updating file date/time stamps.
Related command(s): IFDATE, IFDATETIME, IFTIME, GETNEXTFILE, GETSITEFILE, GETFILE, FTPGETFILE, DATEADD, DATESUB See also: Using the %date, %datetime, and %time Variables, Comparing Local and Remote Files |