Copy files to another package folder (root, su)

人盡茶涼 提交于 2019-12-22 09:29:40

问题


I have my application's package (com.my.package) and i'd like to be able to copy some files (a.txt, b.txt and c.txt) to another package (data/data/com.another.package/files). Now i've tried a few things i found, but none worked. Any help please?


回答1:


You need to get the Runtime and use the cat command.

Runtime.getRuntime().exec("su cat filepath1 > filepath2");



回答2:


Runtime.getRuntime().exec("su cat filepath1 > filepath2");

creates an empty file for me too. I have to use su -c instead

Runtime.getRuntime().exec("su -c cat filepath1 > filepath2");


来源:https://stackoverflow.com/questions/15886744/copy-files-to-another-package-folder-root-su

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!