Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2013 16:51
Show Gist options
  • Save anonymous/4494730 to your computer and use it in GitHub Desktop.
Save anonymous/4494730 to your computer and use it in GitHub Desktop.
This script copies all data from /data/data to any directory(in sdcard) and (soft)links back them in /data/data.
To use it, first make sure the DESTDIR exists, change it according to your need, mkdir it. here i used /data/sdext2 which is a ext partition on sdcard mounted by link2sd.
copy the script to android,
`adb push linkappdata.sh /sdcard/`
now goto shell,
`adb shell`
become root,
`su`
now run it,
`sh /sdcard/linkappdata.sh`
wait till it finishes.
#!/system/bin/sh
cd /data/data
DESTDIR=/data/sdext2/skdata/
for DIRS in `find . -mindepth 1 -maxdepth 1 -type d`
do
cp -r $DIRS /data/sdext2/skdata/
rm -r $DIRS
ln -s /data/sdext2/skdata/$DIRS $DIRS
done
echo finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment