I have rooted my device HTC Evo Design 4G and I try to adb pull /data data and it says "0 files pull 0 file skipped"
I was able to pull /System/build.prop. How can I pull the root folder?
I have rooted my device HTC Evo Design 4G and I try to adb pull /data data and it says "0 files pull 0 file skipped"
I was able to pull /System/build.prop. How can I pull the root folder?
Files and directories below /data/data are protected from the "average user", so you cannot simply "pull" them unless the ADB daemon is running in root mode. Other than the file you were referring to (/system/buildprop is at least readable by all apps), folders below /data/data are "invisible" (except for root), so they cannot even be read.
To be able to use adb pull on them, you need to make your ADB daemon run in root mode first. Depending on the device, a simple adb root command might do that – but most devices will refuse to do. In those cases, you can use chainfire's adbd insecure: Install this app on your device, start it there, and manually switch to "insecure" mode. Now the pull should succeed.
Remark: It's called "insecure" because running adbd as root gives everybody with a computer and an USB cable access to everything on your device. Just in case you wonder.
Can I use adb shell setprop ro.secure 0?
– user3734225 Jul 05 '14 at 01:20If your phone's rooted, there are three ways to go around this. The first one is to use ADBD insecure.
The other one is to move it to another folder with root and then pull it from there:
$ adb shell
shell@android:/ $ su
root@android:/ # mkdir /sdcard/data
root@android:/ # cp /data/data/* /sdcard/data
root@android:/ # exit
shell@android:/ $ exit
$ adb pull /sdcard/data .
$ adb shell
shell@android:/ $ rm -r /sdcard/data/
shell@android:/ $ exit
I think you can build a script such as:
echo 'echo "mkdir /sdcard/data; cp $1/* /sdcard/data; exit" | su; exit' | adb shell
adb pull /sdcard/data .
echo 'rm -r /sdcard/data; exit' | adb shell
and save it somewhere.
Finally, the third option is chmod -R 1777 /data/data, but this is much more unsafe, so it's highly discouraged.
$1 would be the first argument provided to the script, in this case it would be referring to a directory. So if that script was in a file called extractdir.sh you could call it with ./extractdir.sh /path/to/target/dir.
– h0r53
Feb 18 '20 at 16:38
echo "echo 'mkdir /sdcard/data; cp -r $1 /sdcard/data; exit' | su; exit" | adb shell
You cannot pull data folder directly since adb doesn't have file listing access to it. If you want to pull the /data folder you can do it via recovery ([Custom recovery, CWM/TWRP] run adb while device is in recovery mode, hopefully a custom recovery). Or as root, copy /data to another directory (sdcard) and pull it from there.
I read in a Google search setting ro.secure build property to 0 will help pull /data. Is this true? If so is there a way to do it?
– user3734225 Jul 04 '14 at 07:23This is what worked for me:
Make sure you're using the latest ADB version.
Start the ADB session: adb shell
Get SU rights once in the ADB session all you have to do it's type su like so: su. Then you'll notice that the $ becomes #.
Make a folder on the /sdcard of the device: mkdir /sdcard/data/
Head to the root of the file you want to copy.
/data/app #An example of what I get if I ls that folder:
root@m1:/data/app # ls
com.abtnprojects.ambatana-1
com.acr.rootfilemanager-1
com.amazon.kindle-1
com.android.chrome-1
com.android.mms-1
com.android.vending-2'
In order to copy recursively with the ADB cp command, use the option -R and since I wanted to copy everything in it, I used the wildcard *
like so: cp -R */ /sdcard/data/
Once you press enter, if the file is fairly large it will obviously take a while to copy the files, so the cursor will idly blink for a bit, it will look like if not doing anything, BUT IT IS! it's copying the files, so don't panic! and don't stop the process!
ls check and you should see that the empty folder is now getting populated with the files. Once the transfer is done, you'll get your shell back.Head to the sdcard/data and make sure everything was copied ls:
'root@m1:/sdcard/data # ls
com.abtnprojects.ambatana-1
com.acr.rootfilemanager-1
com.amazon.kindle-1
com.android.chrome-1
com.android.mms-1'**
By this point, if you haven't created a folder on the target machine, do so. I conveniently created a folder called apps
Now, let's do the elusive recursive ADB PULL of all the files at once:
root@m1:/sdcard/data # exit
shell@m1:/ $ exit
adb pull, you don't have to
use the -a option, I personally use it to keep the integrity of the
files as much as possible. Run the command: adb pull -a /sdcard/data/ apps/You should see something like this:
[ 69%] /sdcard/data/com.google.android.gms-1/base.apk: 74%
Once it's done:
/sdcard/data/: 296 files pulled. 5.1 MB/s (1193942288 bytes in 221.352s)
And Voila!
Side Notes:
Working on my Android 7.1 device. Steps to get it working:
adb shell in your adb directorysu so u can get the "#"setenforce 0You can now adb pull into your PC.
adb rootfirst? – aleksikallio Jul 04 '14 at 06:35