nextcloud: Fix subfolder sync
[shutils.git] / nextcloud / nextcloud-inotify-sync
index e310352443ef34996c8b20bc61b0bf961c1fe2e9..d1249048cbb35390f375ad00c7a8f304967608b4 100755 (executable)
@@ -21,7 +21,7 @@ after some period, whatever happens first. The nextcloudcmd is called with
 netrc for login.
 
 Usage:
- $0 [OPTIONS] source_dir server_url
+ $0 [OPTIONS] source_dir server_url [ARGS...]
  $0 -h
 
 OPTIONS:
@@ -30,9 +30,10 @@ OPTIONS:
   -s        Silent, be less verbose
   -t SECS   Sync period if nothing changed locally.
             Default: 180
+  ARGS      Passed to nextcloudcmd
 
 EXAMPLE
-    $0 ~/.vimwiki https://cloud.example.com/remote.php/webdav/vimwiki
+    $0 ~/.vimwiki https://cloud.example.com --path vimwiki
 EOF
 }
 
@@ -41,7 +42,7 @@ IWAIT_OPTS=""
 
 SILENT=0
 ONESHOT=0
-PERIOD=180
+PERIOD=600
 
 while getopts "host:" OPTION; do
        case "${OPTION}" in
@@ -70,6 +71,8 @@ shift $((OPTIND-1))
 
 SOURCE_DIR=$1
 SERVER_URL=$2
+shift
+shift
 
 if [ -z "${SOURCE_DIR}" ] ; then
        echo "No source directory given."
@@ -83,7 +86,7 @@ if [ -z "${SERVER_URL}" ] ; then
        exit 1
 fi
 
-NCC_OPTS="${NCC_OPTS} ${SOURCE_DIR} ${SERVER_URL}"
+NCC_OPTS="${NCC_OPTS} $@ ${SOURCE_DIR} ${SERVER_URL}"
 
 while true; do
        echo "About to sync..."