-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackpack.sh
More file actions
45 lines (26 loc) · 729 Bytes
/
backpack.sh
File metadata and controls
45 lines (26 loc) · 729 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
#Desktop user data backup script
#Set these parameters
current_user=$USER
backup_location="/media/truecrypt1/user-data/$current_user"
exclude_hidden=".*"
exclude_this="Downloads"
#Todays date in ISO-8601 format:
DAY0=`date -I`
#Get the latest backup directory from the target
DIRS=`ls $backup_location | awk '{print $NF}' | sort`
for DIR in $DIRS
do
DAY1=${DIR}
done
#The source directory:
SRC="/home/$current_user/"
#The target directory:
TRG="$backup_location/$DAY0"
#mkdir -p $TRG
#The link destination directory:
LNK="$backup_location/$DAY1"
#The rsync options:
OPT="-avh --delete --exclude=$exclude_hidden --exclude=$exclude_this --link-dest=$LNK"
#Execute the backup
rsync $OPT $SRC $TRG