Mass delete of File
Hi!
Can we do a mass files deletion using ABAP Program without specifying the exact file name? If we use 'OPEN DATASET' and 'DELETE DATASET' command, it requires a specific filename. If I want to delete files in the server begins with SW, can I delete SW* ( wildcard filenames), what command can we use in the ABAP program in order to achieve this ? Do you have any suggestion by calling OS command within the ABAP program to do this.
Your advice will be much appreciated.
Thanks!
Teddybear
Hi deedee
use this fm WS_EXECUTE
Hope that helps.
_________________
Regards
Abaper
Don't think that WS_EXECUTE will help for server files.
Some options that I can see.
1. If you have an appropriate OS command defined, such as rm 'additional parameters' you can use that via SM49 or via FM SXPG_CALL_SYSTEM.
2. If you have access to write code in the system in question, you could do the old:
Data: v_command(254) type c.
v_command = 'rm /usr/sap/path/etc/SW*'.
CALL 'SYSTEM' ID 'COMMAND' FIELD V_COMMAND
ID 'TAB' FIELD I_TAB-*SYS*.
3. Ask someone who has OS access to delete the files for you.
4. Don't screw with this stuff unless you KNOW what you are doing.
Hi
If you debug transaction AL11 you will find that it uses some systemcalls to read the files in a given directory on the server.
It is fairly easy to reproduce these calls in your own program, so you shoud be able to pick up the filenames and then perform a delete-dataset.
Brian
Just to help you along...
In AL11 - Form "GET_DIRECTORY" performs a call to "FILL_FILE_LIST" which reads the actual files.
Just start AL11 - use /H to enter debug mode and pick a directory and you should be right about there...
Thats it
Brian
Thanks everybody for the input!
_________________
TB