android - Copy Files and directories with su command on rooted device -


similar questions asked here, can´t figure out, have do. not duplicate, because solutions on many threads here not looking or doesn´t work me. want copy files , directories folder inside /data/ folder. so, made lot of search on , googled hours. threads found not clear enough , don´t let me want. found blogs, doesn´help me.

http://su.chainfire.eu/

http://forum.xda-developers.com/showthread.php?t=1694251

what have tried

i able copy directory sd /data/ directory without need su command , works java code. first question: root permission not neccessary copying /data/ folder sd card? next step have done is, execute su command this:

process pp  = runtime.getruntime().exec("su cat "+origindir+" > "+targetdir); 

where orgindir path on sd card file , targetdir folder inside /data/ directory strings, example:

/data/test/testfile.txt 

the problem here is, can copy file, has 0 bytes. doing wrong?

what want

  1. i want copy file sd card /data/ directory
  2. i want create folder on /data/ directory
  3. i want t o copy whole directory /data/ directory

i have searched lot, can´t find tutorial using su command write files directory. also, there list anywhere in android available su commands can executed programmatically? belive me, not lazy developer, have searched many things, hadn´t find tutorial this.

use ths copy linux command , add -r (recursive) switch cp -r /source/ /target/. create target if not exists

but prior need make system writable

mount -o remount,rw /system  cp -r /source/ /target/ mount -o remount,ro /system #don't forget this, if else fails!!!! 

edit: according comments below, solution should used when targeting relatively new devices


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -