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 copy/delete file

Former Member
0 Kudos

hi,

i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.

does any one have any idea how am i going to code the abap program for this?

thanks

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

> i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.

>

i am assuming that your Application server is Unix.

unixcommand cp is used to copy the a file from one directory to another.

cp /dir/file1 /dir2/file2

the above command will copy the file1 of dir1 to file2 of dir2.

for delete use the command rm,

rm /dir/fiel1

the above command will remove the file1 from directory dir.

REPORT ZUNIX line-size 400
                no standard page heading.
 
 
parameters : unixcom like   rlgrap-filename.   
 
 
data: begin of tabl occurs 500,
        line(400),
      end of tabl.
 
data: lines type i.
  
*----------------------------------------------------------------------
 
start-of-selection.
  refresh tabl.
 
  call 'SYSTEM' id 'COMMAND' field unixcom
                id 'TAB'     field tabl[].
 
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing

5 REPLIES 5

Former Member
0 Kudos

It's simple.

Use the FM's:

1. gui_upload (in order to copy the file into your internal table).

2. WS_FILE_DELETE (in order to delete the file).

3. gui_download (in order to create the file at the new path).

Hope it's solving your problem.

Regards,

Rebeka

former_member188685
Active Contributor
0 Kudos

> i need to come out a program, which can copy/delete file from unix directory A to directory B, on the application server.

>

i am assuming that your Application server is Unix.

unixcommand cp is used to copy the a file from one directory to another.

cp /dir/file1 /dir2/file2

the above command will copy the file1 of dir1 to file2 of dir2.

for delete use the command rm,

rm /dir/fiel1

the above command will remove the file1 from directory dir.

REPORT ZUNIX line-size 400
                no standard page heading.
 
 
parameters : unixcom like   rlgrap-filename.   
 
 
data: begin of tabl occurs 500,
        line(400),
      end of tabl.
 
data: lines type i.
  
*----------------------------------------------------------------------
 
start-of-selection.
  refresh tabl.
 
  call 'SYSTEM' id 'COMMAND' field unixcom
                id 'TAB'     field tabl[].
 
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing

0 Kudos

hi,

but from the program you show, how am i going to code the command into the program, or where it pass from? can you please advice in the details?

really appreciate. thanks

0 Kudos
REPORT ZUNIX line-size 400
                no standard page heading.
 
 
data : unixcom like   rlgrap-filename.   
 
 
data: begin of tabl occurs 500,
        line(400),
      end of tabl.
 
data: lines type i.
  
*----------------------------------------------------------------------
 
start-of-selection.
  refresh tabl.
 
"cp /dir/file1 /dir2/file2
"the above command will copy the file1 of dir1 to file2 of dir2.
"for delete use the command rm,
"rm /dir/fiel1
"the above command will remove the file1 from directory dir.

 unixcom =  'cp /dir/file1   /dir/file2'.   "<----here you fill the command 

 "if you want to use the rm 
 unixcom =  'rm /dir/file1 '.   "<----here you fill the command 
  call 'SYSTEM' id 'COMMAND' field unixcom
                id 'TAB'     field tabl[].
 
"if any error or any thing you get in the tabl
"just check the tabl once after the finishing

Former Member
0 Kudos

This message was moderated.