Put file in a folder on NextCloud

  • Go to NextCloud, open Settings -> Security -> fill “App name” -> click “Create new app password”, so we got login and pass.

  • Create folder in your NextCloud.

  • Fill varables with your own values:

      NEXTCLOUD_USER=your-username
      NEXTCLOUD_PASSWORD=your-app-password
      NEXTCLOUD_FOLDER=gitlab-backups
      PATH_TO_BACKUP=gitlab-backups
      BACKUP_NAME=1691665722_2023_08_10_14.9.2_gitlab_backup.tar
      NEXT_CLOUD_URL=https://your.cloud.tld
  • Run the script:

    
      curl --fail --show-error -u "$NEXTCLOUD_USER:$NEXTCLOUD_PASSWORD" -T "$PATH_TO_BACKUP/$BACKUP_NAME" "$NEXT_CLOUD_URL/remote.php/webdav/$NEXTCLOUD_FOLDER/$BACKUP_NAME"