initial commit
This commit is contained in:
commit
a83a99dc1d
7 changed files with 447 additions and 0 deletions
55
fhnw-teams-sync
Executable file
55
fhnw-teams-sync
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue