I have a problem when I try to copy folders inside /data/data to SDcard.
I have my phone rooted.
I request Superuser permissions in my app with:
Runtime.getRuntime().exec("su");
I'm using FileUtils
from Apache to copy files/folders.
What I discovered is if I manually change the folders permissions to READ
I can copy it from /data/data to SDcard.
Is there any way to recursively change the RW
permissions of all folders inside /data/data to read and write folders?
I've tried chmod
but It doesn't work.
Runtime.getRuntime().exec("chmod 777 /data/data");
I want to do a backup program and i want to read some folders inside /data/data and write them in a SDcard's folder.
Then I want to restore this folders reading them from a SDcard's folder and write them in /data/data.
Could you help me, please?
At the end I got it!!!!
I use the SuperUser process with the cp command to copy the files and folders.
I hope you find it helpful.
String comando = "cp -r /data/data/sourcefolder /sdcard/targetfolder";
Process suProcess = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(suProcess.getOutputStream());
os.writeBytes(comando + "\n");
os.flush();
os.writeBytes("exit\n");
os.flush();
try
{
int suProcessRetval = suProcess.waitFor();
if (255 != suProcessRetval)
{
// Acceso Root concedido
retval = true;
}else
{
// Acceso Root denegado
retval = false;
}
}
catch (Exception ex)
{
Log.w("Error ejecutando el comando Root", ex);
}
Thank you very much to all the people of this forum and for all the help which you offer!!