Skip to Content
Former Member
Aug 09, 2007 at 01:41 PM

Retrieve the date a file was created in the background



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:


  • 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,


Message was edited by:

Ryan Quackenboss