-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhone backup
More file actions
27 lines (22 loc) · 840 Bytes
/
Phone backup
File metadata and controls
27 lines (22 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
!/bin/bash
# This script lets you make a backup of all Android device folders to an
# Ubuntu system. Of course, only user folders can be copied.
# Chapter one: declaring needed routes to avoid the script getting messy.
DEV_ROUTE=/run/user/1000/gvfs
BACKUPTARGET=home/$USER/PhoneBackup
# Chapter two: look for the device and store its route.
echo "Looking for the device..."
cd /
cd $DEV_ROUTE
DEV_ROOT="$(echo *)"
cd "$DEV_ROUTE/$DEV_ROOT"
DEV_STORAGE="$(echo *)"
# Chapter three: routing to target folder and copying files.
cd "$DEV_ROUTE/$DEV_ROOT/$DEV_STORAGE"
echo "Found device. Copying folders..."
# Let's do it right and add a date to folder name.
cp -R Android/ /$BACKUPTARGET/Android-$(date +"%A-%d-%m-%Y-%r")
# There's no need to be rude.
echo "I finished. See you soon."
# A couple seconds before returning to bash.
sleep 2