Rename File with Root

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.

Answers


Change

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

to

cmds.add("mount -o remount rw /system \n");

Need Your Help

REALbasic array in an array

php arrays realbasic xojo

I am trying to write a soap parameter in REALbasic.

Upload file from GWT to php Server

php gwt file-upload

I want to upload a file from a GWT form panel to php server;

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.