File Date & Time

longhair

Member
morning all,
progress 9.1c
hpux 11
is there a command within progress to get an external file's date and time stamp or do i need to use os-command?
thanks in advance.
regards,
longhair
 

StefGay

Member
Hi, take a look to file-info system handle (in your case you can use file-info:file-size for example)

Regards.
Stéphane.
 

longhair

Member
Stéphane,

i saw the file-info handle but it does not appear to have what i need.
i need the date and time stamp of the file.
file-info:file-size does return the size of the file but file-info:file-date returns an error "Unknown attribute file-date used in widget:attribute phrase. (3406)"
guess i'll play with input through value() and os-command.
regards,
longhair
 

StefGay

Member
Ok i've only test with windows but i sav in the kb that file-create-date is for windows only but perhaps file-mod-date works with hp-ux.
 

doreynie

Member
You must first set the file-info handle to a valid file

so first :

file-info:file-name = "....."

and then you can access :

file-info:file-create-date
or
file-info:file-create-time
or
...
 

longhair

Member
doreynie,

on hpux your suggestion only returns a '?'
Code:
def var ca_file1 as char format "x(60)".                                        
def var ca_file2 as char format "x(60)".                                        
ca_file1 = "/somedir/somefile.txt".                                             
                                                                                
file-info:file-name = ca_file1.                                                 
ca_file2 = string(file-info:file-create-date).                                  
display ca_file2.
if i remove the string function it returns nothing for the date and a '?' for the time.
as a work around the following works:
Code:
input through value( "ls -l " + "/somedir/somefile.txt").                       
import unformatted ca_file.                                                     
ca_file1 = substring(ca_file,46,35).                                            
input close.
regards,
longhair
 

bulklodd

Member
doreynie,
on hpux your suggestion only returns a '?'

it looks like a bug but you can workaround the problem as follows

Code:
DEFINE VARIABLE fi AS CHARACTER  NO-UNDO.
INPUT THROUGH VALUE('ls -l test.p').
/* fi keeps all information about test.p file */
IMPORT UNFORMATTED fi.
INPUT CLOSE.

HTH
 

doreynie

Member
Looks like the file-create-date and file-create-time function is supported on windows only. On HPUX you should be able to use the file-mod-date and file-mod-time.

NB : one should have the right permissions on the file-system to access the data you want to retrieve. See documentation about the file-info handle.
 

bulklodd

Member
Looks like the file-create-date and file-create-time function is supported on windows only. On HPUX you should be able to use the file-mod-date and file-mod-time.

NB : one should have the right permissions on the file-system to access the data you want to retrieve. See documentation about the file-info handle.

I've checked probaly you're right, create-date & create-time attributes live only on win32. I think it's OS feature but nevertheless you can use mod-date & mod-time to get timestamp besides win32 they're available on Solaris & Unixware as well.

Code:
FILE-INFO:FILE-NAME = "<your file>".
MESSAGE "<name>" ENTRY(1,PROGRAM-NAME(1)," ") SKIP
   FILE-INFO:FILE-CREATE-DATE SKIP
   STRING(FILE-INFO:FILE-CREATE-TIME,"HH:MM:SS") SKIP
   FILE-INFO:FILE-MOD-DATE SKIP
   STRING(FILE-INFO:FILE-MOD-TIME,"HH:MM:SS") 
   VIEW-AS ALERT-BOX INFO BUTTONS OK TITLE "DEBUG".
 
Top