Question

Hi in my Filemanager i want to add an Option to rename Files in /system directory. Ive tried this to add to my code. It doesnt work. What did I wrong?

public static void renameRootTarget(String oldname, String name)
        throws IOException, InterruptedException {

    Process process = Runtime.getRuntime().exec("su");
    DataOutputStream out = new DataOutputStream(process.getOutputStream());
    out.writeBytes("mount -o remount rw /\n");
    out.writeBytes("mv /system/" +oldname + "/system/"+ name + "\n");
    out.writeBytes("exit\n");
    out.flush();
    process.waitFor();
}

oldname is the selected file and name is the new filename created with an EditText.

Was it helpful?

Solution

Change

out.writeBytes("mount -o remount rw /\n"); 

to

cmds.add("mount -o remount rw /system \n");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top