summaryrefslogtreecommitdiff
path: root/bin/extra/muz-sync
blob: 0c2dba21cf163f742a6cf862f2729a829a6e8733 (plain)
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
#!/bin/sh
trap "exit 1" INT

[ "$1" ] && path="$1" || path="/media/basilisk/music/sorted/"
[ "$2" ] && music="$2" || music="$(xdg-user-dir MUSIC)"
[ "$3" ] && host="$3" || host="autumn"

>&2 printf '%s:%s -> %s\n' "$host" "$path" "$music"

>&2 printf 'Confirm? [y/N] '
answer="$(head -n 1)"
[ "$answer" ] || exit 1

if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then 
	exit 1
fi

# retry until failure
while ! rsync \
	--recursive \
	--verbose \
	--partial \
	--progress \
	--ignore-existing \
	--size-only \
	"$host":"$path" "$music"
do :
done