Getting data from an Android phone

Reading the file system on an Android from Windows

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:

  1. Download Android Debug Bridge (platform tools) so you can access the phone from the terminal/command prompt. Executable installer here.

  2. 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 for Environment 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.

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

  4. Also turn on USB debugging on the phone.

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

  6. If you want to browse the contents of your phone, you can type adb shell and then use the ls command to list the files on the devices, and cd to change directories. I.e. cd storage would move you into the storage directory. To exit the shell, type exit and press Enter.

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

  1. First - connect the phone to the computer by cable.
  2. Then, find out the IP address of the phone on your local network, like 192.168.1.10.
  3. In the termainl/command prompt, type adb tcpip 5555 to restart the ADB to run over network on port 5555.
  4. In the terminal, type adb connect 192.168.1.10:5555, or whatever the IP address of the phone is.
  5. Disconnect the USB cable.
  6. You should now be able to see your device over Wi-Fi by typing adb devices.

Note to self