Java tutorial
//package com.java2s; //License from project: Apache License import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void copyFile(String sourceFile, String desFile) { Log.d("TAG", "copyFile source file path : " + sourceFile); Log.d("TAG", "copyFile des file path : " + desFile); Log.d("TAG", "copyFile result is : " + do_exec("cp -f " + sourceFile + " " + desFile)); } public static String do_exec(String cmd) { String s = "/n"; try { Process p = Runtime.getRuntime().exec(cmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { s += line + "/n"; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return s; } }