How to copy selected files from Android with adb pull
You can move your files to other folder and then pull whole folder.
adb shell mkdir /sdcard/tmp
adb shell mv /sdcard/mydir/*.jpg /sdcard/tmp # move your jpegs to temporary dir
adb pull /sdcard/tmp/ # pull this directory (be sure to put '/' in the end)
adb shell mv /sdcard/tmp/* /sdcard/mydir/ # move them back
adb shell rmdir /sdcard/tmp # remove temporary directory
adb pull multiple files
You can use xargs
and the result of the adb shell ls
command which accepts wildcards. This allows you to copy multiple files. Annoyingly the output of the adb shell ls
command includes line-feed control characters that you can remove using tr -d '\r'
.
Examples:
# Using a relative path
adb shell 'ls sdcard/gps*.trace' | tr -d '\r' | xargs -n1 adb pull
# Using an absolute path
adb shell 'ls /sdcard/*.txt' | tr -d '\r' | sed -e 's/^\///' | xargs -n1 adb pull
Android: adb pull file on desktop
Use a fully-qualified path to the desktop (e.g., /home/mmurphy/Desktop
).
Example: adb pull sdcard/log.txt /home/mmurphy/Desktop
How to transfer files from Phone to PC using ADB?
Use the following command:
adb pull /storage/sdcard0/pictures/screenshots/ C:\Users\<username>\Downloads
You will find the folder named 'screenshots' at the location C:\Users\<username>\Downloads
adb pull multiple files with the same extension
adb shell ls sdcard/folder/*.ext | tr '\r' ' ' | xargs -n1 adb pull
See adb pull multiple files
How do I adb pull ALL files of a folder present in SD Card
Single File/Folder using pull
:
adb pull "/sdcard/Folder1"
Output:
adb pull "/sdcard/Folder1"
pull: building file list...
pull: /sdcard/Folder1/image1.jpg -> ./image1.jpg
pull: /sdcard/Folder1/image2.jpg -> ./image2.jpg
pull: /sdcard/Folder1/image3.jpg -> ./image3.jpg
3 files pulled. 0 files skipped.
Specific Files/Folders using find
from BusyBox
:
adb shell find "/sdcard/Folder1" -iname "*.jpg" | tr -d '\015' | while read line; do adb pull "$line"; done;
Here is an explanation:
adb shell find "/sdcard/Folder1" - use the find command, use the top folder
-iname "*.jpg" - filter the output to only *.jpg files
| - passes data(output) from one command to another
tr -d '\015' - explained here: http://stackoverflow.com/questions/9664086/bash-is-removing-commands-in-while
while read line; - while loop to read input of previous commands
do adb pull "$line"; done; - pull the files into the current running directory, finish. The quotation marks around $line are required to work with filenames containing spaces.
The scripts will start in the top folder and recursively go down and find all the "*.jpg" files and pull them from your phone to the current directory.
Related Topics
Can Gradientcolor Be Used to Define a Gradient for a Fill or Stroke Entirely in Xml
Multiple Apps Use Same Content Provider
How to Limit Fling in Android Gallery to Just One Item Per Fling
How to Dynamically Change an App Icon Like Calendar App Does
Switching Between Fragment View
Event for Videoview Playback State or Mediacontroller Play/Pause
Communicating with Serial Usb Device Over Android
Unexpected Namespace Prefix "Xmlns" Found for Tag Linearlayout
How to Programmatically Scroll Android Webview
Edittext Settext Not Working with Fragment
How Does One Implement Drag and Drop for Android Marker
How to Set Up Multiple Listeners for One Event
Android Maps API V2 Draw Circle
Filling a Circle Gradually from Bottom to Top Android
How to Send File from Android Device to Other Device Through Bluetooth by Code
How to Detect a Dual-Core CPU on an Android Device from Code