IFDATE        Conditional branch upon date comparison

Top  Previous  Next

Form 1

Syntax:

IFDATExx

[ date1 ] [ date2 ] GOTO  [ label ]

Forms:

IFDATE=

[ date1 ] [ date2 ] GOTO  [ label ]

 

IFDATE<

[ date1 ] [ date2 ] GOTO  [ label ]

 

IFDATE>

[ date1 ] [ date2 ] GOTO  [ label ]

 

IFDATE<=

[ date1 ] [ date2 ] GOTO  [ label ]

 

IFDATE>=

[ date1 ] [ date2 ] GOTO  [ label ]

 

IFDATE! =

[ date1 ] [ date2 ] GOTO  [ label ]

Arguments:

[ date1 ]

Variable or string defining a date in the format of mm.dd.yy

 

[ date2 ]

Variable or string defining a date in the format of mm.dd.yy

 

[ label ]

A valid label within the current script file which is branched to if the date condition is satisfied.

Options:

none

 

 

 

Form 2

Syntax:

IFDATE

[ result_code ]  GOTO  [ label ]

Arguments:

[ result_code ]

Variable or string defining a date condition to test against the internal %comparedate variable.  See Comparing Local and Server Files for details.

 

[ label ]

A valid label within the current script file which is branched to if the date condition is satisfied.

Options:

none

 

 

 

Form 3

Syntax:

IFDATExx

[ date ]  GOTO  [ label ]

Forms:

IFDATE=

[ date ]  GOTO  [ label ]

 

IFDATE<

[ date ]  GOTO  [ label ]

 

IFDATE>

[ date ]  GOTO  [ label ]

 

IFDATE<=

[ date ]  GOTO  [ label ]

 

IFDATE>=

[ date ]  GOTO  [ label ]

 

IFDATE! =

[ date ]  GOTO  [ label ]

Arguments:

[ date ]

Variable or string defining a date in the format of mm.dd.yy to compare against the date stamp of the file obtained with the most recently executed GETNEXTFILE, GETFILE, GETSITEFILE, or FTPGETFILE script command.

 

[ label ]

A valid label within the current script file which is branched to if the date condition is satisfied.

Options:

none

 

 

 

Form1 of this command is used to compare two specified date strings in the format of mm.dd.yy.

 

Form 2 of this command is used in conjunction with the FILECOMPARETO and FILECOMPAREFROM script commands to test the results of a date/time stamp comparison of a local file and a file on the FTP site.

 

Form 3 of this command is used in conjunction with the most recently executed GETNEXTFILE, GETFILE, GETSITEFILE, or FTPGETFILE command to compare the date of the file with a specified date string.

 

When specifying a date, leading zeroes are required. The following are examples of valid date strings.

 

01-30-00January 30, 2000
12-25-99December 25, 1999

 

Syntactically, no space is permitted to the left of the ‘!’, '=', '<' or '>' symbols, and a space is required to the right of these symbols.

 

Example of Form 1

 

The following conditional branch is taken if the current date is past June 30, 2003.

 

IFDATE> %date "06-30-03" GOTO later_date

 

Example of Form 2

 

Possible result codes stored in %comparedate for the FILECOMPARETO command are listed below.

$ERROR_SRVR_FILE_NEWER

1221

File on server is newer

$ERROR_SRVR_FILE_OLDER

1222

File on server is older

$ERROR_NO_SRVR_FILE_EXISTS

1228

File does not exist on server

$ERROR_FILES_SAME_DATETIME

1241

Local and FTP site files share same date/time

 

Possible result codes stored in %comparedate for the FILECOMPAREFROM command are listed below.

$ERROR_LOCAL_FILE_NEWER

1232

Local file is newer

$ERROR_LOCAL_FILE_OLDER

1233

Local file is older

$ERROR_NO_LOCAL_FILE_EXISTS

1239

Local file does not exist

$ERROR_FILES_SAME_DATETIME

1241

Local and FTP site files share same date/time

 

In the following example, the conditional branch is taken if a local file is older than the corresponding file on the FTP site.

 

FILECOMPAREFROM "c:\Program Files\Robo-FTP X.X\thisfile"

IFDATE $ERROR_LOCAL_FILE_OLDER GOTO found it

 

Example of Form 3

 

The following conditional branch is taken if a local file just obtained with the GETNEXTFILE command has a date stamp after June 30, 2003.

 

GETNEXTFILE "*.txt"

IFDATE> "06-30-03" GOTO good_file

 

 

Related command(s): IFDATETIME, IFTIME, FILECOMPARETO, FILECOMPAREFROM, GETNEXTFILE, GETFILE, GETSITEFILE, FTPGETFILE, DATEADD, DATESUB

See also: Comparing Local and Remote Files, Comparing File Dates and Times, Using the %date, %datetime, and %time Variables