11 May 2012 amits   » (Journeyer)

Using adb To Copy Files To / From Your Android Device

Some devices, like the Galaxy Nexus and the HP Touchpad* (via the custom Android ROMs) don’t expose themselves as USB storage devices.  They instead use MTP or PTP to transfer media files (limiting to only photos and audio/video files being shown from the device).

This happens due to there being no separate sdcard on these devices, and ‘unplugging’ an sdcard from a running device to be exposed to the connected computer could cause running apps on the device itself to malfunction.  Android developer Dan Morill explains this here. He also mentions how the Nexus S doesn’t have this problem.

There are several apps that can open shares to the device using one of several protocols (DAV, SMB, etc.).  However, one quick way I’ve found to copy files to and from the device connected via USB to a computer is by using the adb tool.  It’s available as part of the ‘android-tools’ package on Fedora.

To copy a file from the computer to an android device connected via usb, use this:

adb push /path/to/local/file /mnt/sdcard/path/to/file

This will copy the local file to the device in the specified location.  Directories can be created on the device via the shell:

adb shell

and using the usual shell commands to navigate around and create directories.

* On the Touchpad, WebOS can expose the storage as a USB Storage Media.  The current nightly builds of CM9 can’t.

Syndicated 2012-05-11 11:10:16 (Updated 2012-05-12 14:07:59) from Think. Debate. Innovate. - Amit Shah's blog

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!