Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pull photos with ADB from local storage - android device

i have some problems with my Asus Zenfone 2 device (no root).

In particular, some days ago, while i was travelling abroad, my device decided to no more turn on, staying permanently in the loading ASUS screen.

Before doing the hard reset, i want to try to save at least all my photos located in the internal storage (N.B: i do not have an external SDCARD).

i correctly set up the ADB software to recognize my device but i am not able to find the photo directory.

Till now i have only pull successfully 2 directory: "sys" and "cache", using this command:

adb pull / C:\Myfile

It seems to transfer only some file system.

Doas anyone know how to pull photos or other file?

like image 543
zzari Avatar asked Aug 28 '16 17:08

zzari


2 Answers

Use adb pull sdcard/DCIM/Camera C:\MyFile

If it didn't work use:

adb shell
echo $EXTERNAL_STORAGE

It will print path to your simulated external storage. Then:

cd $EXTERNAL_STORAGE/DCIM
ls

It will print folder which will contain camera app folders. Lastly, use:

adb pull HERE_PUT_PATH_TO_EXTERNAL/DCIM/SELECTED_CAMERA_APP_FOLDER C:\MyFiles

Note: To leave adb shell type exit

like image 91
pr0gramist Avatar answered Oct 18 '22 22:10

pr0gramist


I did 3 things to pull all files of the same type, in this case *.mp4 (all videos)

1. First copy the output of: {all videos listed} with xargs to a file.txt

adb shell ls /storage/7C17-B4FD/DCIM/Camera/*.mp4 | xargs -t -I % echo % >> file.txt  

adb shell ls /storage/7C17-B4FD/DCIM/Camera/*.mp4 returns all videos listed in device. The argument -t show the output from XARGS, and -I lets you use a variable, in this case represented with % then you write the command you want to do. In this case, echo % each line and add it to the file.txt

2. You need to clean the file.txt from spaces and the '\r' you do it with the command tr

tr -d '\r' < file.txt > text-clean.txt  

the input file is < file.txt and the new output file is > text-clean.txt

3.Now you can cat the new clean file text-clean.txt and use that input with XARGS command to pass the command adb pull for each file.

cat text-clean.txt | xargs -t -I % adb pull % ./ 

we cat the content of text-clean.txt and send the output to XARGS, then we see what is the result of command with -t and -I to add variables. adb pull to request file from path which is represented with % and ./ means copy to this directory or currrent directory of where you are.

if you just need to copy one file. just need to find the file with adb shell ls /path/to/file and the just copy to your location with adb pull. example

adb pull /storage/7C717-B4FD/DCIM/Camera/video1.mp4 ./
 
like image 2
AlexPixel Avatar answered Oct 18 '22 20:10

AlexPixel