Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve the date a file was created in the background

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

Q,

Where is this file located? It is on the client or the app server?

0 Kudos

The file is located on a Window NT share. I am using the UNC path to get to it:
xxxx\folder\subfolder

0 Kudos

Hey - try FM OCS_GET_FILE_INFO

0 Kudos

Or FM - /SDF/GET_FILE_INFO

0 Kudos

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

0 Kudos

LOL !!!! Enjoy...

and don't forget those points!!!

0 Kudos

I will be happy to.

Please post something to this thread.

I UNMARKED this question as a post and reposted in the data transfer forum.

That post is still open. Once you post there, I will mark it ANSWERED and award points.

Thanks for the help

Quack