Last active
September 1, 2021 02:25
-
-
Save amane-katagiri/f26578e694ca1efca778c837351d8e85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -Cue | |
if [ $# -ge 2 ]; then | |
SRC="$1" | |
DST="$2" | |
else | |
echo "usage: $0 SRC DST" >&2 | |
exit 1 | |
fi | |
if [ -f "${HOME}/.nextcloud_token" ]; then | |
CRED="$(cat "${HOME}/.nextcloud_token")" | |
elif [ -z "${CRED+UNDEF}" ];then | |
echo "Set env or credential file:" >&2 | |
echo "- \`CRED=user:token $0 $@\`" >&2 | |
echo "- \`echo 'user:token' > '${HOME}/.nextcloud_token'\` and \`$0 $@\`" >&2 | |
exit 1 | |
fi | |
if command -v nextcloudcmd >/dev/null; then | |
CLOUDCMD=nextcloudcmd | |
elif command -v owncloudcmd >/dev/null; then | |
CLOUDCMD=owncloudcmd | |
else | |
echo 'no (next|own)cloudcmd found.' >&2 | |
fi | |
EXCLUDE_LIST=$(mktemp) | |
curl -Sso "$EXCLUDE_LIST" https://github.com/owncloud/client/raw/master/sync-exclude.lst | |
"$CLOUDCMD" --exclude "$EXCLUDE_LIST" "$SRC" "https://${CRED}@nc.ama.ne.jp/remote.php/webdav${DST}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment