-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate_ssd.sh
executable file
·55 lines (44 loc) · 1.5 KB
/
validate_ssd.sh
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
46
47
48
49
50
51
52
53
54
55
#!/bin/zsh
# runs yabrc compare on all laptop vs SSD backup indexes
# optionally updates the indexes before comparing them
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
SOURCE=/Users/hunter
DEST=/Volumes/SSDBackup
. $DIR/functions.sh
# update the indexes when update is specified
UPDATE=
set +o nounset
if [[ "$1" == "update" ]]; then
UPDATE=(update --autosave)
# specify 'update full' to re-checksum all files instead of just changes
if [[ "$2" != "full" ]]; then
UPDATE=($UPDATE --fast)
fi
fi
set -o nounset
if [[ "$UPDATE" != "" ]]; then
# run yabrc update on source
yabrc_update mac backup documents development pictures raw
echo
# run yabrc update on backup
yabrc_update ssd backup documents development images raw
ok
fi
# else run with existing indexes
yabrc_compare mac ssd backup documents development
set +o errexit
echo "\n----- pictures -----\n"
$YABRC compare $YABRC_DIR/mac/mac_pictures.properties $YABRC_DIR/ssd/ssd_images.properties
# mac raw is a partial copy, use ignoreMissing to only compare the files that are on both
echo "\n----- raw -----\n"
$YABRC compare --ignore_missing $YABRC_DIR/mac/mac_raw.properties $YABRC_DIR/ssd/ssd_raw.properties
set -o errexit
echo
echo "Updating data not on laptop..."
# data not on laptop; nothing to compare, just update
if [[ "$UPDATE" == "" ]]; then
UPDATE=(update --autosave --fast) # default to --fast
yabrc_update ssd media_noimages raw
else # use existing update command
yabrc_update ssd media_noimages # raw was already updated
fi