08-09-2007 2:41 PM
EDITED CONTENT----
Apologies all...I just realized there is a specific forum for this type of question. I will post it there.
Thanks Marilyn for point this out>>>>should have read it first as suggested.
/message/2572763#2572763 [original link is broken]
-
Hi guru's,
I have a custom application that does some windows directory cleaning based an older than 'X' days setting. I have to do some calculation to determine if the file being processed is older than that number of day and delete it if it is. To determine the file created date I use the method DIRECTORY_LIST_FILES from CL_GUI_FRONTEND_SERVICES. This works great in the foreground but dumps in the background because the handle object reference is not created in the class constructor and subsequently does a call to a "NULL" object.
My question:
Does anyone know of a way to get the date a file was created while running in the background? If not, please read on --- I have another question regarding an alternate approach I am trying.
I have tried the following approach FM EPS_GET_DIRECTORY_LISTING to return an internal table with all files in a directory. Works fine in the background, but the created date is not in the return values. Soooooo I looped at the internal table and called this system function:
CALL 'C_FILE_ATTRIBUTES'
ID 'NAME' FIELD tempfile
ID 'TYPE' FIELD singleFile-
ID 'LEN' FIELD file-len
ID 'OWNER' FIELD file-owner
ID 'MTIME' FIELD file-mtime
ID 'MODE' FIELD file-mode
ID 'ERRNO' FIELD file-errno
ID 'ERRMSG' FIELD file-errmsg.
This returns the MTime, which is the Modified time (in Epoch time format: number of seconds since Midnight 1 January 1970), but no created time. Does anyone know the ID for the created time? I tried CTIME but no value is returned.
Along with this question: any idea if a FM or Method exists to convert Epoch time to a standard time. I could do the calculation myself....but it seems someone would have already done this. No point in re-creating the wheel.
Thanks so much,
Quack
Message was edited by:
Ryan Quackenboss
08-09-2007 3:07 PM
Q,
Where is this file located? It is on the client or the app server?
08-09-2007 3:42 PM
The file is located on a Window NT share. I am using the UNC path to get to it:
xxxx\folder\subfolder
08-09-2007 3:51 PM
08-09-2007 3:53 PM
08-09-2007 4:09 PM
That worked!!!!!!!!!!!!!!!
How could I NOT find that FM. The Created date isn't returned, but the modified date is...that will suit my needs.
You are the man John. The thought of creating my own FM to calculate the date based on the EPOCH time made me dry heave a little.
Thanks a lot,
Quack
08-09-2007 4:13 PM
08-09-2007 5:16 PM