Created
January 20, 2022 12:43
-
-
Save ptrcnull/7ac55f516295da93c7ed30d22a0d5bd6 to your computer and use it in GitHub Desktop.
recover android app from data backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/bin/sh | |
if [[ ! -d "$1" ]]; then | |
echo local not found | |
exit 1 | |
fi | |
if [[ ! -d "/data/data/$1" ]]; then | |
echo data not found | |
exit 1 | |
fi | |
user=$(ls -la "/data/data/$1" | sed -n '2p' | cut -d' ' -f5) | |
rm -r "/data/data/$1/files" | |
rm -r "/data/data/$1/databases" | |
rm -r "/data/data/$1/shared_prefs" | |
rm -r "/data/data/$1/cache" | |
echo removed old | |
cp -r "$1/files" "/data/data/$1/files" | |
cp -r "$1/databases" "/data/data/$1/databases" | |
cp -r "$1/shared_prefs" "/data/data/$1/shared_prefs" | |
echo moved new | |
chown -R "$user:$user" "/data/data/$1/files" | |
chown -R "$user:$user" "/data/data/$1/databases" | |
chown -R "$user:$user" "/data/data/$1/shared_prefs" | |
echo changed permissions | |
echo done! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment