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

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


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

If it didn't work use:

adb shellecho $EXTERNAL_STORAGE

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

cd $EXTERNAL_STORAGE/DCIMls

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


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 ./