Created
June 22, 2021 12:57
-
-
Save mMarcos208/033e56a4cc0f5f256ef64359598ab904 to your computer and use it in GitHub Desktop.
Export realm file from android
This file contains hidden or 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
| #!/bin/bash | |
| ADB_PATH="/home/marconi/Android/Sdk/platform-tools" | |
| #Name of your package | |
| PACKAGE_NAME="XXX" | |
| DB_NAME="default.realm" | |
| DESTINATION_PATH="/home/marconi/Downloads/${DB_NAME}" | |
| NOT_PRESENT="List of devices attached" | |
| ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'` | |
| if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then | |
| echo "Make sure a device is connected" | |
| else | |
| echo ${ADB_PATH}/adb | |
| ${ADB_PATH}/adb exec-out run-as ${PACKAGE_NAME} cat files/${DB_NAME} > ${DESTINATION_PATH} | |
| echo "Database exported to ${DESTINATION_PATH}" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
change .txt to .sh