Skip to Content
avatar image
Former Member

Delete the files in Unix

Hi

My program downloading data to Unix.

My requirement is, before download to unix i need to delete the existing files started with 2703 cost* .

Is it possible to use wild card? Pls help me

Regards

Anbulakshmi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 08, 2008 at 04:42 AM

    I have done this. To access the file from UNIX...

    To access the file..

    *-c list in time order.

    CONCATENATE 'ls -c' p_fin INTO w_list_commandin

    SEPARATED BY space.

    CONCATENATE w_list_commandin '/.' INTO w_list_commandin.

    • CALL unix list command - will populate itab_file_list ITAB

    CALL 'SYSTEM' ID 'COMMAND' FIELD w_list_commandin ID 'TAB'

    FIELD it_file_list-sys.

    To delete..

    • Remove the file once it is processed

    CONCATENATE 'rm' it_file_list-file_name

    INTO w_runcmd SEPARATED BY space.

    • send command to unix to move item file

    CALL 'SYSTEM' ID 'COMMAND' FIELD w_runcmd.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 08, 2008 at 04:32 AM

    Use FM EPS_DELETE_FILE of you may delete from AL11 also.elese use Delete dataset in your program(But it won't take wild card).

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 08, 2008 at 04:33 AM

    I dont think wild cards will work with dataset statements.

    One possible way is to get the list of all the files in the target directory using FM EPS_GET_DIRECTORY_LISTING and then looping into the return table and doing string comparison to find the required file. and delete the file if found using DELETE dataset in the loop.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 08, 2008 at 04:36 AM

    Hi

    Pls check the FORUM, you will get lot of answers.

    I checked one of the link

    abap-with-unix

    Regards

    Madhan

    Add comment
    10|10000 characters needed characters exceeded