initial commit

This commit is contained in:
Sebastian Hugentobler 2023-06-22 09:45:46 +02:00
commit a83a99dc1d
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
7 changed files with 447 additions and 0 deletions

55
fhnw-teams-sync Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env sh
set -o errexit
dest_dir="$HOME/documents/fhnw/teams"
sources=""
display_help() {
echo "Usage: $0 [option...] " >&2
echo
echo " -d, root destination directory [default: $dest_dir]"
echo " -s, list of configured rclone teams sources (pipe separated)"
echo " -h, display this help and exit"
echo
}
parse_args() {
while getopts ":hd:s:" opt; do
case $opt in
h)
display_help
exit 0
;;
d)
dest_dir=$OPTARG
;;
s)
sources=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
display_help
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
display_help
exit 1
;;
esac
done
}
sync_teams() {
echo "syncing teams..."
oldIFS=$IFS
IFS='|'
for s in $sources; do
rclone sync --progress "$s:" "$dest_dir/$s"
done
IFS=$oldIFS
}
parse_args "$@"
sync_teams