-
Notifications
You must be signed in to change notification settings - Fork 2
/
2tbu
executable file
·25 lines (23 loc) · 648 Bytes
/
2tbu
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
#!/bin/bash
from=/dev/disk/by-label/BC_2T_ext
to=/dev/disk/by-label/BC_1T_ext
if [[ -e $from && -e $to ]]; then
if ! grep "$(readlink -fn $from)" /proc/mounts >/dev/null; then
from_unmounted="1"
udisks --mount $from
fi
if ! grep "$(readlink -fn $to)" /proc/mounts >/dev/null; then
to_unmounted="1"
udisks --mount $to
fi
rsync --exclude '/1tb' --exclude '/System Volume Information' --exclude '/RECYCLER' -ritP --delete /media/${from##*/}/ /media/${to##*/}/
if [[ $from_unmounted = "1" ]]; then
udisks --unmount $from
fi
if [[ $to_unmounted = "1" ]]; then
udisks --unmount $to
fi
else
echo 'Drives not found!' >&2
exit 1
fi