Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- RLIB 3.0a Reference - <b>function:</b> filedate() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function:    FILEDATE()

Purpose:     Retrieve the last update date for a given file from DOS.

Syntax:      FILEDATE( filename )

Arguments:   filename    - Character string or variable indicating the
                           name of the file for which to extract the date.
                           This filename (filespec) must and may adhere to
                           any fully qualified filename as required by
                           ADIR().

Returns:     Date from the file directory entry (last update date).

Description: This function extracts the date from the given file directory
             entry information.  It is useful for comparing the dates of
             two files, or for using the file date for a variety of
             purposes.  FILEDATE() may be used in conjunction with
             FILETIME() to determine if an index file is current with the
             associated .DBF file.  FILEDATE() simplifies all the ADIR()
             and associated lines of code to get the file date.

Notes:       If an invalid filename is given, or if the file does not
             exist, FILEDATE() will return an empty date (  /  /  ).
             Beware that if the file being checked is currently open, the
             date from the directory entry may not reflect updates until
             the file is closed.

Example:     *-- see if the date and time of the .DBF and .NTX files agree
             ok = (FILEDATE("myfile.dbf") == FILEDATE("myfile.ntx") .AND.;
                   FILETIME("myfile.dbf") == FILETIME("myfile.ntx"))
             USE myfile INDEX myfile
             IF .NOT.  ok
                pbox = SAYINBOX("Please wait, updating index")
                REINDEX
                GO TOP
                POPBOX(pbox)
             ENDIF


             *-- a second example, prompt user for file backup request
             lastback = FILEDATE("myfile.bak")
             IF BOXASK("MYFILE.DBF was last backed up on"+DTOC(lastback),;
                       "Do you want to back it up now? (Y/N) ") = "Y"
                ERASE myfile.bak
                COPY FILE myfile.dbf TO myfile.bak
             ENDIF

Source:      RL_FILED.PRG

See also:    FILESIZE(), FILETIME()

See Also: FILESIZE() FILETIME()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson