Skip to main content

How to use Android Debug Bridge to copy data out of your Android device

I recently built an Android application that had the capability to export data in XML format to the devices external storage directory.

External storage directory path in Android OS can be accessed using the android.os.Environment package. Following code return the path for the external storage directory: 

Environment.getExternalStorageDirectory().getPath()

To copy data from this storage into your local device, you can use the Android Debug Bridge command line tool which comes installed with the Android SDK platform. 

The following command will pull a single file named filename.ext out of the device and copy it to your local computer:

adb pull /sdcard/filename.ext ./filename.ext

If you want to copy multiple files with certain extension to your local computer you can use Adb's shell command capability. 

The following command will pull all files with .xml extension to your local file for example:

adb shell ls /sdcard/*.xml | tr '\r' ' ' | xargs -n1 adb pull

You can also use adb and shell commands to get Sqlite3 data directory out of your device. Following command can be used to copy the entire Sqlite3 data directory into the devices external sdcard storage. 

adb -d shell 'run-as com.app cat /data/data/com.app/databases/dbname > /sdcard/dbname'

You can use the adb pull command to pull the export to your local computer. 

adb pull /sdcard/dbname ./dbname



Comments

nekopoiapk said…
This was an interesting article to read. I became more curious about Xuper TV APK after reading the explanation of its features and general interface. The information about how users can navigate through different sections was especially helpful. In my opinion, these practical details are often more useful than a long list of specifications. It would be interesting to see a follow-up article covering the experience across different devices and screen sizes. The current article is a good introduction for readers who want to understand the application before exploring its features further.
nekopoiapk said…
Your article was incredibly helpful and much more detailed than many others I found online. I appreciate how clearly everything is explained from beginning to end. I was mainly looking for information about Freecine Download, but I also learned more about the Freecine APK and its features. The navigation feels smooth, and browsing different categories has been enjoyable. Searching for Baixar Freecine led me here, and I'm glad it did. The guide also helped me understand the terms Freecine Online, Freecine GrĂ¡tis, and where to find the correct Link for additional information.
Magistvdownload said…
App content is much more enjoyable when the writer explains the subject naturally instead of simply listing features. That is one reason I found this article particularly helpful. After reading it, I decided to explore Xuper Hydra Celular APK, and so far the experience has been comfortable. The interface is fairly intuitive, and the app feels responsive during regular use. I also appreciate how easy it is to understand the main options. Thanks for sharing such a useful article. It provided exactly the kind of background information I was looking for before trying something new.