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: 

Delete the files in Unix

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

madan_ullasa
Contributor
0 Kudos

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.

4 REPLIES 4

former_member181995
Active Contributor
0 Kudos

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).

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi

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

I checked one of the link

Regards

Madhan

madan_ullasa
Contributor
0 Kudos

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.