-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloud_sync.sh
More file actions
24 lines (20 loc) · 747 Bytes
/
Copy pathcloud_sync.sh
File metadata and controls
24 lines (20 loc) · 747 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
#!/bin/sh
SRC_CLOUD_ID=${SRC_CLOUD_ID:-}
DST_CLOUD_ID=${DST_CLOUD_ID:-}
RCLONE_CLI=${RCLONE_CLI:-rclone}
src_path=$1
dst_path=$2
if ! ${RCLONE_CLI} > /dev/null; then
echo "Please install rclone to run this script."
exit 1
elif [ $# -ne 2 ] && [ -z ${src_path} ] && [ -z ${dst_path} ]; then
echo "Please provide two arguments, sh cloud_sync.sh <src_path> <dst_path>."
exit 1
elif [ -z ${SRC_CLOUD_ID} ]; then
echo "Please set SRC_CLOUD_ID to the rclone alias for your cloud source."
exit 1
elif [ -z ${DST_CLOUD_ID} ]; then
echo "Please set DST_CLOUD_ID to the rclone alias for your cloud destination."
exit 1
fi
${RCLONE_CLI} sync --create-empty-src-dirs ${SRC_CLOUD_ID}:${src_path} ${DST_CLOUD_ID}:${dst_path}