How do I get the latest file from a directory in Progress 4gl?

Status
Not open for further replies.
U

user3715001

Guest
DEFINE VARIABLE cDir AS CHARACTER NO-UNDO initial '/home/raj/'.

define temp-table tt-file
field tfile as char format "x(22)".
define variable vfile as char format "x(22)" no-undo.

INPUT FROM OS-DIR (cDir) ECHO.

REPEAT:

create tt-file.
IMPORT tt-file.tfile.
FILE-INFO:FILE-NAME = cDir + tt-file.tfile.
if file-info:file-name begins cdir + "RATES"
and string(month(file-info:file-mod-date)) = string(month(today)) THEN
DISPLAY tt-file.tfile FORMAT "X(22)" LABEL 'name of the file'
FILE-INFO:FULL-PATHNAME FORMAT "X(21)" LABEL 'FULL-PATHNAME'
FILE-INFO:pATHNAME FORMAT "X(30)" LABEL 'PATHNAME'
FILE-INFO:FILE-TYPE FORMAT "X(5)" LABEL 'FILE-TYPE'
file-info:file-mod-date.
end.


The problem I face is I have multiple files for the current month but I need to get latest file for the month.

Continue reading...
 
Status
Not open for further replies.
Top