cancel
Showing results for 
Search instead for 
Did you mean: 

Can we write Unix commands in Module Development?

Former Member
0 Kudos

Hi,

I want to move files from one directory to another by using unix command in custom module development.

Is it possible in module developement.If it is yes please provide me solution.

thanks in advance

regards

rams....

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Use the code below:



String command = new StringBuffer("mv -f").append(' ').append(
				sourceFolder).append('/').append(fileName).append(' ').append(
				errorFolder).toString();
try 
		{
			Runtime.getRuntime().exec(command);
} 
		catch (IOException e)
		{
throw new ModuleException(e);
}

Former Member
0 Kudos

.

Former Member
0 Kudos

Any Solution..........

prateek
Active Contributor
0 Kudos

Why do u want to use the unix command in adapter module. U may directly use it in file adpater using OS command option both at the sender and receiver channels. There u can use the command before or after the message processing

Regards,

Prateek

Former Member
0 Kudos

Any Solution..........

Former Member
0 Kudos

Check this

|help.sap.com/saphelp_nw04/helpdata/en/43/6f3f4347336fc9e10000000a1553f6/content.htm - ]

Former Member
0 Kudos

Hi ,

Yes you can run Unix commands in Java program like this -

class StartShut1

{

public static void main(String[] args)

{

try {

String cmd="command.sh";

System.out.println(" the cmd is: "+cmd);

Process p =Runtime.getRuntime().exec(cmd);

int i = p.waitFor();

System.out.println("Exit value of process is "+j);

System.out.println("Output of the Cmd is : "+i);

String s=null;

}//main

}//class

Regards,

Kishore