Skip to Content

Delete old files from application server (UNIX)

Hi All,

I need to write an ABAP program to delete files which are older then 30 days from application server (UNIX).

i am using the below code to get all the file names into internal table.

CALL 'SYSTEM' ID 'COMMAND' FIELD UNIXCOM

ID 'TAB' FIELD TAB1[].

But, How do i get the properties of the file like ( Date and time of the file). If i have the date of the file i can delete them using it.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 18, 2008 at 07:01 PM

    Check this FM might be helpful -

    ADS2KIPUPL_GET_FILE_ATTRIBUTES

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 18, 2008 at 07:12 PM

    Hi there..

    if you can get the set of list or use

    EPS_GET_DIRECTORY_LISTING

    submitting this prog will get you the list rs_get_f4_dir_from_applserv

    use

    delete dataset <DS name>.

    [Link to get file list|http://www.sapdev.co.uk/file/file_browsefile.htm]

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi I am able to use EPS_GET_FILE_ATTRIBUTES:

      Output: but its not giving you the date though..

      FILE_NAME                       AT060001.DAT
      DIR_NAME                        D:\USR\SAP\SBX\DVEBMGS06\DATA
      
      
      Export parameters               Value
      
      FILE_SIZE                       99,250
      FILE_OWNER                      Administ
      FILE_MODE                       666
      FILE_TYPE                       file, regu
      FILE_MTIME
      FILE_SIZE_LONG                                           99,250

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 09:04 PM

    This really isn't an ABAP issue. Your system/basis administrator should have utilities to do this.

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 18, 2008 at 10:26 PM

    Hi

    While you are callng UNIX command, please pass "ls -l" command which brings out all file properties including date and time when file got created.

    CALL 'SYSTEM' ID 'COMMAND' FIELD UNIXCOM

    ID 'TAB' FIELD TAB1[].

    Best Regards,

    Krishna

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 22, 2008 at 10:39 PM

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.