]> git.hoellein.online Git - zenbook_bin/commitdiff
Änderunen bzgl. der Angabe des
authorMario Höllein <mhoellein@freenet.de>
Wed, 5 Feb 2020 13:57:55 +0000 (14:57 +0100)
committerMario Höllein <mhoellein@freenet.de>
Wed, 5 Feb 2020 13:57:55 +0000 (14:57 +0100)
Datums
Source löschen
Nutzer in Nextcloud

getPicturesFromHomecloud.sh

index d0d62b2a06fec34a43a691f8bc652dbfe9c98e4b..cc0243675e143f10847bbb2912d0c4389d5c1a9e 100755 (executable)
@@ -1,15 +1,75 @@
 #!/bin/bash
 
-NEXTCLOUDUSERS="mhoellein nelly susi"
+POSITIONAL=()
+while [[ $# -gt 0 ]]
+do
+       key="$1"
+       
+       case $key in
+               -u|--user)
+               NEXTCLOUDUSER="$2"
+               shift # past argument
+               shift # past value
+               ;;
+               -d|--date)
+               DATE="$2"
+               shift # past argument
+               shift # past value
+               ;;
+               -r|--remove)
+               REMOVE="$2"
+               shift # past argument
+               shift # past value
+               ;;
+               *)    # unknown option
+               POSITIONAL+=("$1") # save it in an array for later
+               shift # past argument
+               ;;
+       esac
+done
+set -- "${POSITIONAL[@]}" # restore positional parameters
+
+if [[ -n $1 ]]; then
+    echo "Last line of file specified as non-opt/last argument:"
+    tail -1 "$1"
+fi
+
+if [ "$NEXTCLOUDUSER" == "" ];then 
+       NEXTCLOUDUSER="mhoellein nelly susi"
+fi
+
+if [ "$DATE" == "" ];then
+       DATE=`date +%Y/%m`
+fi
+
+
+if [ "$REMOVE" != "" ];then
+       case "$REMOVE" in
+               [yY][eE][sS]|[yY]|[jJ]|[jJ][aA])
+                       REMOVE='--remove-source-files';
+                       ;;
+               *)
+                       REMOVE='';
+                       ;;
+       esac
+else
+       REMOVE='';
+fi
+
 NEXTCLOUDSERVER="home.hoellein.online"
 PWD=`pwd`
-if [ "$1" != "" ];then
-       NEXTCLOUDUSERS=$1
-fi
 
 #/localhome/nextcloud/data/mhoellein/files
+echo "NEXTCLOUDUSER   = ${NEXTCLOUDUSER}"
+echo "DATE            = ${DATE}"
+echo "REMOVE          = ${REMOVE}"
+
+#echo "rsync -av ${REMOVE} --rsh=\"ssh -p 1194\" root@home.hoellein.online:/localhome/nextcloud/data/$u/files/SofortUpload/Camera/${DATE}/ ${PWD}"
+#exit
 
-for u in $NEXTCLOUDUSERS
+
+for u in $NEXTCLOUDUSER
 do
-       rsync -av --rsh="ssh -p 1194" root@home.hoellein.online:/localhome/nextcloud/data/$u/files/SofortUpload/Camera/`date +%Y/%m`/ ${PWD}
+        rsync -av ${REMOVE} --rsh="ssh -p 1194" root@home.hoellein.online:/localhome/nextcloud/data/$u/files/SofortUpload/Camera/${DATE}/ ${PWD}
 done
+