Application Development and Automation 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: 
Read only

How to move multiple files from one folder to another in application server using SXPG_COMMAND_EXECUTE ?

Former Member
0 Kudos
1,657

Hi,

I have a requirement where I need to move multiple files in a directory to another folder using the SXPG_COMMAND_EXECUTE , I am able to move a single file from one directory to another and renaming by adding date and time stamp but how to move multiple files ?

For eg:  Suppose In a directory X there are 10 files starting at " text_<xxxx>" , in the parameter user will give physical path and text* so that the program should copy all the 10 files starting with text and move to destination folder adding the date and time stamp (renaming) ?

The selection screen has two parameters ( source  and destination ) !

Thanks,

Sreejith S.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Kudos
857

The answer to this question is depending on the OS that manages your Server and not much on Abap

Regards,

Raymond

6 REPLIES 6
Read only

Former Member
0 Kudos
857

Sreejith,

     Have you tried using wild card characters for writing the command?

     Something like MV text_* <destination>  I haven't personally worked on that but just a suggestion.

Hope this helps,

~Athreya

Message was edited by: Athreya Hegde

Read only

RaymondGiuseppi
Active Contributor
0 Kudos
858

The answer to this question is depending on the OS that manages your Server and not much on Abap

Regards,

Raymond

Read only

0 Kudos
857

Hi Raymond,

I know that, but currently they are asking to do with abap, is there any possibility to achieve this functionality through abap.

Regards,

Sreejith S.

Read only

Former Member
0 Kudos
857

Hi ,

You need to check with your basis team to write a shell script which takes care of searching files based on a string and moving all the files to a new location.

Once they are done with the script  ,they shall create a command in SM49 and provide you which you can use it in the function call SXPG_COMMAND_EXECUTE.

Thanks and Regards,

Sriranjani Chimakurthy.

Read only

Former Member
0 Kudos
857

Dear All,

I have got the solution. I have used the EPS_GET_DIRECTORY_LISTING for getting all the files from the source dictionary and then extract only files  which I want to move to the destination. Then by looping the SXPG_COMMAND_EXECUTE I can move multiple files to the destination.

Regards,

Sreejith S.

Read only

arindam_m
Active Contributor
0 Kudos
857

Hi,

No it has to be done based on the application server OS and using the SXPG_COMMAND_EXECUTE fm.

Cheers,

Arindam