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: 

How to Select the Latest file from Application Server?

former_member502730
Participant
0 Kudos

Dear All,

I am working on object, which had requirement to Pick the file from application server.

The Application server contain the files in ‘/temp/sms/’ directory. The files are having the name Like ‘smsqry_yyyymmddhhmmss.txt’ and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333’) from that all and after getting the file I have to delete the file from application server.

So How to do this.

Regards

3 REPLIES 3

naimesh_patel
Active Contributor
0 Kudos

Hello,

Whenever you generate the file on the application server, store the name of the file in on database table or memory. Later on retrive the name and read your file from application server.

To delete the file, use DELETE DATASET dsn.

Regards,

Naimesh

christian_wohlfahrt
Active Contributor
0 Kudos

Hi!

You can get a list of all files with FM SXPG_COMMAND_EXECUTE - in table SXPGCOSTAB you can have a look for the available commands.

Make a DIR or LS, the result table will contain the file list.

Either you read all files (open dataset, read dataset), or you sort by name descending and take only the first one. Deletion is possible with 'delete dataset'.

Regards,

Christian

andreas_mann3
Active Contributor
0 Kudos

hi,

look function group EPSF-

esp. fm EPS_GET_DIRECTORY_LISTING

if you're looking fo OS-date and time

look here:

A.

Message was edited by: Andreas Mann