Skip to content

Instantly share code, notes, and snippets.

@mammuth
Last active August 29, 2015 14:25
Show Gist options
  • Save mammuth/838ff41575951b38dc33 to your computer and use it in GitHub Desktop.
Save mammuth/838ff41575951b38dc33 to your computer and use it in GitHub Desktop.
Backup the complete data of any android app to your computer. Using ADB. Requires root for ADB.
#!/bin/bash
# This little shell script copies a backup of a certain app into the folder
# backup/ within the execution directory
# requires root via adb access
appToBackup="org.thoughtcrime.securesms" #change package name
tmpStore="tmpBackup_"$appToBackup"/"
adb devices
echo "Starting adb shell and creating Backup"
# copy the app data to sdcard
adb shell "su -c'mkdir -p /sdcard/$tmpStore;cp -r /data/data/$appToBackup /sdcard/$tmpStore;exit;exit'"
echo "adb shell closed"
# pull the backup
storeAt=`pwd`"/backup" #local folder
mkdir -p $storeAt
adb pull -p /sdcard/$tmpStore $storeAt
# remove the app data which temporarily has been stored on sdcard
adb shell "su -c 'rm -r /sdcard/$tmpStore'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment