We had the need to copy (and delete) files from an Android phone, connected to a Windows computer.
Here are the steps outline for how we solved it:
-
Download Android Debug Bridge (platform tools) so you can access the phone from the terminal/command prompt. Executable installer here.
-
Unpack the folder, and then - if you want access to the
adb
command from anywhere in the command prompt, it needs to be added to PATH. Search Windows forEnvironment Variables
setting; it’s a button at the bottom of the “System Properties” settings dialog under the “Advanced” tab. Select the Path option and click Edit button. Add a New path to the list with the directory where you unpacked the platform tools. See Part 2 at Nerds Chalk for detailed instructions. -
On your Android phone, you need to enable developer mode. I.e. go to
Settings --> About phone --> Build number
and tap it 7 times. See instructions here for other devices. -
Also turn on USB debugging on the phone.
-
Connect the phone to your computer with a cable, and verify that it’s seen with
adb devices
. You should get an ID for the phone. -
If you want to browse the contents of your phone, you can type
adb shell
and then use thels
command to list the files on the devices, andcd
to change directories. I.e.cd storage
would move you into the storage directory. To exit the shell, typeexit
and press Enter. -
To copy files from the device, exit the shell once you’ve found the path. Then use the following format:
adb -s {{DEVICE_IDENTIFIER}} pull {{PATH_ON_PHONE}} {{PATH_ON_COMPUTER}}
For example:
adb -s 192.168.1.10 pull /sdcard/Download C:\Users\Jenni\Desktop
Here’s a list of other adb commands for reference.
Running it over Wi-Fi
You can also run this over Wi-Fi.
- First - connect the phone to the computer by cable.
- Then, find out the IP address of the phone on your local network, like
192.168.1.10
. - In the termainl/command prompt, type
adb tcpip 5555
to restart the ADB to run over network on port 5555. - In the terminal, type
adb connect 192.168.1.10:5555
, or whatever the IP address of the phone is. - Disconnect the USB cable.
- You should now be able to see your device over Wi-Fi by typing
adb devices
.
Note to self
- More than one device:
adb -s {{IP}}:{{PORT}} shell {{COMMAND}}